【问题标题】:Combobox don't recognize character '(' ')'组合框无法识别字符 '(' ')'
【发布时间】:2011-09-02 16:37:48
【问题描述】:

我用很少的数据存储组合框:

var materialstore = Ext.create('Ext.data.Store',{

            //fields : [ 'id','data'],
            model :'Combox',
            data : [ 
            { "id" : "12270",
            "data" : "Basic Monthly Support Contract"}
             , 
            { "id" : "12261",
            "data" : "Business Analysis Hour"}
             ,
            { "id" : "12264",
            "data" : "Project/Consulting (Base System)"}

要更新我的行,我需要做特征来检索 id。 我创建函数来执行此操作,但是当数据字段具有像 '(' 或 ')' 这样的字符时,我的函数不起作用!

在我的函数中,我找到了有效的商店,并获取了与数据字段对应的 id

var store = Ext.getStore(eval(c));
                                    var index = store.findRecord('data',value);
                                    if ( index != null ) {
                                        var rg = new RegExp(value,'gi');
                                        tab = tab.replace(rg,index.get('id'));
                                    }

但是当我在数据字段中有 ')' 时,该函数不返回 id 但数据字段也适用于其他数据!是否存在额外的字符或其他?

【问题讨论】:

    标签: extjs combobox store


    【解决方案1】:

    您可能需要为左括号“(”和右括号“)”使用转义字符代码

    this ASCII Reference

    【讨论】:

    • 我解决了我的问题。我有 TCL 层来开发我的程序,我需要使用 4 个转义字符('\\\(')!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-09-06
    • 2011-06-25
    • 2016-07-23
    • 2010-12-22
    • 2021-12-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多