开发者

extjs how to reset my modified store.... (my pruneMOdifiedRecords doesn't work properly,..)

here my js file :

var fm = Ext.form;
var grid = new Ext.grid.EditorGridPanel({
    height: Ext.get("content").getHeight(),
    width: Ext.get("content").getWidth(),
    store: store,
    pruneModifiedRecords : true,
    clicksToEdit : 1,
    columns:[
        {header: "Kd.Rayon",        dataIndex: 'KD_RAYON',  width:60,   sortable: false},//
        {header: "Kd.Sek",          dataIndex: 'KD_SEK',    width:60,   sortable: false},//
        {header: "Paralel",         dataIndex: 'PARALEL',   width:50,   sortable: false, editor: new fm.TextField({allowBlank: false})},开发者_JAVA百科
        {header: "Absen",           dataIndex: 'ABSEN',     width:50,   sortable: false, editor: new fm.TextField({allowBlank: false})},
    .......
    ],

    stripeRows: true,
    loadMask : {
        msg : 'Loading data...'
    },
    //autoExpandColumn: 'ALAMAT',
    title: 'Siswa', 

    sm: new Ext.grid.RowSelectionModel({singleSelect: true}),
    tbar: [{
        id : 'btnSave',
        iconCls : 'disk',
        tooltip : 'Simpan perubahan data',
        disabled: true,
        text : 'Simpan',
        handler: function(){
            var  records = grid.store.getModifiedRecords();
            if (records.length<=0)
                Ext.Msg.alert("Data","Tidak ada perubahan");
            else{
                var data = [];
                for (i=0; i<records.length; i++){
                    data.push(records[i].data);
                }
                data = Ext.encode(data); 
                Ext.getBody().mask();
                Ext.Ajax.request({ 
                  //url: 'test.php',
                  url: 'php/crud.php',
                  params: {
                    data: data,
                    ACT : "U",
                    FORM: "SISWA",
                    KD_PROP:Pendas.kd_prop,
                    KD_RAYON:Pendas.kd_sek.substring(2,4),
                    KD_SEK:Pendas.kd_sek.substring(4,7)
                  },
                  success: function(res,obj){
                    var json = res.responseText;
                    var o = eval("("+json+")");
                    Ext.Msg.alert("Data",o.info);
                    store.reload();
                    Ext.getBody().unmask();
                  }
               });
            }
        }
    }]
});

here the case,....

first, i edit the first row,..

i save it, it return true, where return is lets say "Upadate success",...

but, when i clicked th button save twice,...

it resend the modifiedRecords...

am i doing wrong??,... how to reset my "modified record"


You have pruneModifiedRecords set on the EditorGridPanel but it needs to be on the Store.

http://dev.sencha.com/deploy/dev/docs/source/Store.html#cfg-Ext.data.Store-pruneModifiedRecords

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜