本帖最后由 jiery666 于 2011-09-03 22:01:16 编辑

解决方案 »

  1.   

    我的代码如下 ,现在的情况是只能输入列表中的第一项,输入下面的项
    return "<b><font color=#008B8B>" + hwlx_Store.getAt(value - 1).data.name + "</font></b>";这行就出错  
    提示 "Microsoft JScript 运行时错误: 'hwlx_Store.getAt(...).data' 为空或不是对象"
     var combo_hwlx = new Ext.form.ComboBox({
            store: hwlx_Store,
            id: 'hwlx_add',
            hiddenName: 'com_hwlxhidden',
            fieldLabel: '货物名称',
            width: 70,
            typeAhead: true,
            emptyText: '请选择...',
            triggerAction: 'all',
            valueField: 'id',
            displayField: 'name',
            loadingText: 'loading...',
            selectOnFocus: true,
            allowBlank: false,
            editable: false,
            mode: 'local',
            blankText: '请选择货物名称'
        });
     var cm_add = new Ext.grid.ColumnModel([
            {header: '货名', dataIndex: 'hwmc_add', id: 'hwmc_add', width: 60, editor: new Ext.form.TextField({}),
            renderer: function(value, meta, record, rowIndex, colIndex, store) {
                if (value < 1) {
                    return "";
                }
                else {
                    return "<b><font color=#008B8B>" + hwlx_Store.getAt(value - 1).data.name + "</font></b>";
                }
            },
            editor: new Ext.form.ComboBox({
                tpl: '<tpl for="."><div ext:qtip="{id}. {name}" class="x-combo-list-item">{name}</div></tpl>',
                store: hwlx_Store,
                typeAhead: true,
                forceSelection: true,
                triggerAction: 'query',
                selectOnFocus: true,
                width: 100,
                editable: true,
                displayField: 'name',
                valueField: 'id',
                hiddenName: 'hwlx_addhidden',
                mode: 'local',
                frame: true,
                resizable: true
            })
        }
      

  2.   

    hwlx_Store.on('beforeload', function(store, options) {  });
        hwlx_Store.load({ params: { start: 0, limit: pageSize} });
        function rendercombox(value, p, r) {
            var index = hwlx_Store.find(Ext.getCmp('comhwlx').valueField, value);
            var record = hwlx_Store.getAt(index);
            var displayText = "";
            if (record == null) { return value; }
            else {return record.data.name;}
        }
        var combox_hwlx =  new Ext.form.ComboBox({
                    id:"comhwlx",
                    store: hwlx_Store,
                    typeAhead: true,
                    forceSelection: true,
                    triggerAction: 'all',
                    selectOnFocus: true,
                    width: 100,
                    displayField: 'name',
                    valueField: 'id',
                    hiddenName: 'hwlx_addhidden',
                    mode: 'remote',
                    frame: true,
                    minListWidth: 220,
                    pageSize: 6,
                    resizable: true,
                    lazyRender:true
        });1:数据已经有了 但是翻页无效 翻到最后一页了 还是第一页的数据?
    2:而且手动输入值没用(就是直接在combox中输入列表中的项目)虽然有值 但是找不到