search

Home  >  Q&A  >  body text

javascript - How to get the data of the selected row in the onClickCell method of the DataGrid form in EasyUI?

            onClickCell: function (rowIndex, field, value) { //在用户点击一个单元格的时候触发。
                var row = $("#dataList").datagrid("getSelected", rowIndex);//这样获取不行,必须先在表单的那一行勾上,才行
                alert(row.State);
                if (his != 1) {           //查看历史记录时无法添加
                    if (field == "AddShLrbl") {
                        $('#dataList').datagrid("beginEdit", rowIndex);
                    }
                    else {
                        $('#dataList').datagrid('endEdit', rowIndex);
                    }
                }
            }
怪我咯怪我咯2834 days ago884

reply all(1)I'll reply

  • 代言

    代言2017-06-12 09:34:37

    I have found the answer in the blog garden, let me share it with you here,
    onDblClickCell: function (rowIndex, field, value) {
    var rows = $('#dataGrid').datagrid('getRows');
    var row = rows[rowIndex];
    var id = row.id;
    }

    reply
    0
  • Cancelreply