2015-09-09 80 views
0

我使用Jqxgrid来显示我的动态数据,因为我的最后一列中有每行都有编辑按钮。我需要点击编辑按钮来执行特定的行编辑。如何编辑jqxgrid代码隐藏的动态行数据

我使用Datatable和smartgridboundfields来显示jqxgrid中的数据。

我该如何执行此类功能?

string html =“”;

  html += "<a id='sedit'>Edit</a>"; 
      html += "<a id='sdelete' style='margin-left: 10px'>Delete</a>"; 

      dr["Actions"] = html; 

这段代码的背后是编辑按钮,我在jqxgrid显示我的代码。

回答

0

在这种情况下,你可以使用beginrowedit

$('#sedit').on('click', function() { 
    // here change the 0 for the row index 
    $("#jqxgrid").jqxGrid('beginrowedit', 0); 
}); 

或者begincelledit

$('#sedit').on('click', function() { 
    // here change the 0 for the row index, 
    // and your column datafield instead of "firstname" 
    $("#jqxgrid").jqxGrid('begincelledit', 0, "firstname"); 
}); 

为了获得行索引: var rowindex = $('#jqxgrid').jqxGrid('getselectedrowindex');