zoukankan      html  css  js  c++  java
  • EXTJS store 某行某列数据更新等操作

    1.可以使用add(Ext.data.Record[] records)或者add(Ext.data.Record record)向store末尾添加一个或多个record。如: 

    var newRecord=new PersonRecord({name:"Tom",age:22}); 
    store.add(newRecord); 

    2.add函数会将新的数据添加到store的末尾,这对其原有的排序方式可能造成破坏,如果希望保持有序,应使用addSorted,调用方法与add相同。可以使用insert方法将记录插入到指定的位置,如:

    var newRecord=new PersonRecord({name:"Tom",age:22}); 
    store.insert(store.getCount(),newRecord); 

    3.删除操作可以使用remove和removeAll函数,如: 

    store.remove(store.getAt(0)); 
    store.removeAll(); 

    4.修改store中的数据:

    store.getAt(0).set("name","Jesse"); 

     5.grid 中的下拉框

     {
            header: '属性值',
            dataIndex: 'PropertyValueName',
             130,
            /* 指定Editor类型是'combo' */
            editor: Ext.create('Ext.form.field.ComboBox', {
                name: 'PropertyValueId',
                typeAhead: true,
                store: comboData_DynaPropertyValue,
                valueField: "PropertyValueId",
                displayField: "PropertyValueName",
                queryMode: 'remote', //local remote
                triggerAction: 'all',
                lazyRender: true,
                repeatTriggerClick: true,
                listeners: {
                    "expand": function (combo, store, index) {
                        var selectedData = grid_DynaProperty.getSelectionModel().getSelection()[0].data;
                        comboData_DynaPropertyValue.load({
                            params: {
                                PropertyId: selectedData.PropId,
                                start: startDynaProperty,
                                limit: limitDynaProperty
                            }
                        });
                    },
                    change: function (field, newValue, oldValue, op) {
                        //当下拉框选择改变的时候,也就是原值不等于新值时
                        if (newValue != oldValue) {
                            alert(newValue);
                            grid_DynaProperty.getSelectionModel().getSelection()[0].set("PropertyValueName", newValue);
                            grid_DynaProperty.getSelectionModel().getSelection()[0].set("PropertyValueId", newValue);
    
                        }
                    }
                }
            })
        }
  • 相关阅读:
    Firefox地址栏样式设定
    定制Eclipse
    超简单的java爬虫
    JavaWeb--中文乱码小结
    编译原理之正则表达式转NFA
    Fedora下Eclipse/MyEclipse崩溃的解决方案
    利用Octopress在github pages上搭建个人博客
    在Eclipse中导入新浪微博SDK
    BlueMix
    云计算的三层简单理解
  • 原文地址:https://www.cnblogs.com/foreverfendou/p/4643287.html
Copyright © 2011-2022 走看看