David
David

Reputation: 4291

How to display value in grid column.

I have a extJS grid with four column. On third column I am modifying the value by button and able to display. In Fourth column I am getting empty string "" as data. I am giving some input and trying to save this in store but it not happening. How to save value in extjs grid store.

var grid = Ext.getCmp('gridID');
    var gridstore = grid.getStore();
    var modify = gridstore.modified;
    for (var i = 0; i < modify.length; i++) {
             modifyRec[i].data.S = "Hello";
}

S is dataIndex of the column.

Upvotes: 0

Views: 563

Answers (2)

Filip
Filip

Reputation: 116

I prepared some fiddle for you. Hope it will help you:

https://fiddle.sencha.com/#fiddle/1f56

To get modiified records i used getModifiedRecords() fuction.

Upvotes: 1

Vinod Gubbala
Vinod Gubbala

Reputation: 754

Better way is to use set, than changing property directly.

var grid = Ext.getCmp('gridID');
var gridstore = grid.getStore();
var modify = gridstore.modified;
for (var i = 0; i < modify.length; i++) {
         modifyRec[i].set('S', "Hello");
}

Edit: In Ext-data-AbstractStore afterEdit fires update event. Which is being called from Model set

Upvotes: 1

Related Questions