Search code examples
extjsextjs3

Hww to change cell value of grid row


I have a grid in which one column have No value. I have a button I bbar. When I click on button I want that value to be changed to yes and complete grid to be strike. so far my code is :

{ 
xtype: 'button', 
text: 'Exclude',
handler : function(){
    var cohartgrid = Ext.getCmp('HART_GRID');
    var cohartstore = cohartgrid.getStore();
    var record = Ext.getCmp('HART_GRID').getSelectionModel().getSelected();
    var st = cohartstore.getRange();
    if(record.data.EXL == "No"){
        debugger;
       var abc = record.data.EXL
       abc.replace("Yes");
    }
}}

Here I want the value should replace yes to No fro UI and from Store.. (Also grid should be strike). I am trying for that.

Thanks in advance


Solution

  • Try this,

    I made answer as per your code.

    { 
        xtype: 'button', 
        text: 'Exclude',
        handler : function(){
        var cohartgrid = Ext.getCmp('HART_GRID');
       var cohartstore = cohartgrid.getStore();
       Ext.getCmp('HART_GRID').getSelectionModel().getSelected();
       var st = cohartstore.getRange();
       if(record.data.EXL == "No"){
       record.set("EXL","YES")
         }
         } 
    
        }
    

    You need to replace the value at record level.