Search code examples
cssextjsextjs3

How to strike a perticular row in extjs on click of button


I have a grid with row. I want to give a strike on click of particular button. Here is my code.

{ 
xtype: 'button', 
text: 'Exclude',
handler : function(){
    debugger;
    var cohartgrid = Ext.getCmp('abc');
    var cohartstore = cohartgrid.getStore();
    var record = Ext.getCmp('abc').getSelectionModel().getSelected();
    var st = cohartstore.getRange();
     if (record) {
        Ext.fly(row).addCls('row-deleted');// This line is not working. 
    }

    if(record.data.EXL == "No"){
       record.set("EXL","YES")
    }
}}

What css I have to put. Thanks for help.


Solution

  • I answered same kind of question in other post. Here you need to get the index of your row and then place strike css by using addClass. remember extjs 3 is not supporting addCls

         var selection = grid.getSelectionModel();
         for(var i=0;i<gridstore.data.length;i++){
          if(selection.isSelected(i)){
          var test = grid.getView().getRow(i);
          var dsd=Ext.fly(test);
          dsd.addClass('StrikeCSS'); // Placing css to that perticular row.
            }
      }
    

    In answer grid is your grid. In selection you getting row index and placing Strike

    .StrikeCSS {
      text-decoration: line-through !important;
       color : BLACK !important;    
    }