【问题标题】:How to strike a perticular row in extjs on click of button如何在单击按钮时在 extjs 中敲击特定行
【发布时间】:2016-07-03 04:14:26
【问题描述】:

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

{ 
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。感谢您的帮助。

【问题讨论】:

标签: css extjs extjs3


【解决方案1】:

我在其他帖子中回答了同样的问题。在这里,您需要获取行的索引,然后使用addClass 放置罢工 css。记住 extjs 3 不支持 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.
        }
  }

答案网格是您的网格。在选择中,您将获得行索引并放置 Strike

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

【讨论】:

    【解决方案2】:

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

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

    【讨论】:

    • 是我需要在任何地方定义的 addRowCls 函数。 ?我收到VM46518:1 Uncaught TypeError: cohartgrid.addRowCls is not a function(…) error.
    • 我认为网格没有任何直接的方法来添加行类。所以首先你必须找到网格的视图,然后在上面添加行。 cohartgrid.getView().addRowCls(rowIndex, 'row-deleted');
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-02-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多