LigerUI中根据该行的元素,删除行

在谢哥 (LigerUI地址http://www.ligerui.com/

谢哥博客http://www.cnblogs.com/leoxie2011/)的帮助下实现了

 

function f_initGrid() {
$("#maingrid").ligerGrid({
columns: [
{
display: '字段', name: 'selectFieldData'
//, editor: { type: 'text' }
},
{
display: '显示名称', name: 'showName',
editor: { type: 'text' }
},
{
display: '控件类型', name: 'ControlTypeID', width: 120, isSort: false, textField: 'ControlTypeName',
editor: { type: 'select', data: ControlTypeList, valueField: 'DepartmentID', textField: 'ControlTypeName' }
},
{ display: '查询逻辑', name: 'Age', width: 50, type: 'int', editor: { type: 'int' } },
{ display: '入职日期', name: 'IncomeDay', type: 'date', width: 100, editor: { type: 'date' } },
{
display: '查询逻辑', name: 'Address',
editor: { type: 'text' }, align: 'left', width: 300
}
],
enabledEdit: true, isScroll: false, usePager: false,
data: SelectFieldsData,
width: '100%'
});
}

 

初始数据,以下开始删除  

            $('#tabFields').tree({
                onCheck: function (node, checked) {
                    if (checked) {
                        tempSelectData = node.text,
                        addNewRow()
                    } else {
                        tempSelectData = node.text,
                        deleteRow(tempSelectData)
                    }
                    //,alert($('#tabFields').tree('getChecked')[0].text);  // 在用户点击的时候提示
                }
            });

  

  function deleteRow(tempSelectData) {
            g = manager = $("#maingrid").ligerGetGridManager();
            //manager.deleteSelectedRow();
            var row; 
            //alert(JSON.stringify(g.rows));
            for (var i in g.rows) {
                //alert(JSON.stringify(row.selectFieldData));
                if (g.rows[i].selectFieldData == tempSelectData) {
                    row = g.rows[i];
                    break;
                }
            }
            if (row != "undefined") {
                manager.deleteRow(row)
            }
        }

  

 

 

  

 

 

posted @ 2014-05-15 18:37  博客园董事长  阅读(919)  评论(0编辑  收藏  举报