PDA

View Full Version : How to update a cell value based on other cell - Ext.grid.plugin.CellEditing



Alex.Muntean@im-c.com
23 Nov 2018, 3:57 AM
Hey everyone,

I'm trying to develop a data table, with cells that can be edited. For this table I need that a specific cell to be updated, based on other cells, therefore to be bind with other cells.

I made a basic application: https://fiddle.sencha.com/#view/editor&fiddle/2nqa

In the previous link you can find a fiddle app, where there is developed a table with months, quarters and total sum.
For the last column, total, I need to update the its value by summing up all other cells on that row. When a cell is changed, the total cell should be updated.

The question comes, how can I bind total column with values of corresponding cells?

I see that on listener I have access to editor, but not sure how can I update a specific cell.


Can some one give me some hints/support on this?

Regards,
AlexM

Alex.Muntean@im-c.com
29 Nov 2018, 1:32 AM
No answer, but I found a way to do this.



validateedit: function (ed, e, eOpts) {
// Update a specific row cell
ed.grid.store.data.items[0].store.data.items[0].data["Apr"] = 5

//Update Total column from the edited row
e.record.data["Total"] = 123;
//Need to update the view, with the new values assigned to total
ed.grid.getView().refresh()
}


validateedit is a listener of cellediting edit plugin