如何在点击按钮时敲击extjs中的特定行

时间:2016-07-03 04:14:27

标签: css extjs extjs3

我有一个带行的网格。我想点击特定按钮罢工。这是我的代码。

{ 
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")
    }
}}

我必须提出什么css。谢谢你的帮助。

2 个答案:

答案 0 :(得分:0)

使用代码在所选行中添加类:

rowIndex = cohartgrid.getStore().indexOf(selectedRecord);
cohartgrid.getView().addRowCls(rowIndex, 'row-deleted');

答案 1 :(得分:0)

我在其他帖子中回答了同样的问题。在这里,您需要获取行的索引,然后使用$file_data = file_get_contents($file_path); $query = mysqli_query($con, "INSERT INTO `dcument_upload ` VALUES (null, '". mysqli_real_escape_string($con, $display_name)."', '".mysqli_real_escape_string($con, $file_data). "', '".mysqli_real_escape_string($con, $file_size)."')"); 放置strike css。记得extjs 3不支持addCls

addClass

回答网格是你的网格。在选择中你获得行索引并放置Strike

     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.
        }
  }