zoukankan      html  css  js  c++  java
  • DataGrid( 数据表格) 组件[6]

    本节课重点了解 EasyUI 中 DataGrid(数据表格)组件的使用方法,这个组件依赖于
    Panel(面板)、Resizeable(调整大小)、LinkButton(按钮)、Pageination(分页)组件。
    一. 修改删除功能

    //双击进入编辑状态
    onDblClickRow : function (rowIndex, rowData) {
    $('#save').show();
    $('#redo').show();
    if (obj.editRow != undefined) {
    $('#box').datagrid('endEdit', obj.editRow);
    }
    if (obj.editRow == undefined) {

    $('#box').datagrid('beginEdit', rowIndex);
    obj.editRow = rowIndex;
    }
    },
    //选中编辑
    edit : function () {
    var rows = $('#box').datagrid('getSelections');
    if (rows.length == 1) {
    $('#save').show();
    $('#redo').show();
    if (this.editRow != undefined) {
    $('#box').datagrid('endEdit', this.editRow);
    }
    if (this.editRow == undefined) {
    var index = $('#box').datagrid('getRowIndex', rows[0]);
    $('#box').datagrid('beginEdit', index);
    this.editRow = index;
    }
    } else {
    $.messager.alert(' 警 告 ! ',' 修 改 时 需 要 或 只 能 选 择 一 行 ! ',
    'warning');
    }
    },
    //增加编号,并设置为复选按钮
    {
    field : 'id',
    title : '编号',
    sortable : true,
    checkbox : true,
    width : 100,
    },
    //选中删除
    remove : function () {
    var rows = $('#box').datagrid('getSelections');
    if (rows.length > 0) {
    $.messager.confirm('确定操作', '您确定要删除当前的记录吗?',
    function (flag) {
    if (flag) {
    var ids = [];
    for (var i = 0; i < rows.length; i ++) {

    ids.push(rows[i].id);
    }
    console.log(ids.join(','));
    }
    });
    } else {
    $.messager.alert('警告!', '请选择要删除的记录', 'warning');
    }
    },

  • 相关阅读:
    题解 CF171G 【Mysterious numbers
    题解 P1157 【组合的输出】
    题解 P3955 【图书管理员】
    题解 P2036 【Perket】
    题解 CF837A 【Text Volume】
    题解 CF791A 【Bear and Big Brother】
    题解 CF747A 【Display Size】
    题解 P1332 【血色先锋队】
    题解 P2660 【zzc 种田】
    题解 P4470 【[BJWC2018]售票】
  • 原文地址:https://www.cnblogs.com/qinsilandiao/p/5015247.html
Copyright © 2011-2022 走看看