datagrid 小结

来源:互联网 发布:js数组复制extend 编辑:程序博客网 时间:2024/06/15 21:28
      onBeforeLoad: function () {
                  $(this).datagrid('rejectChanges');
              },
              onLoadSuccess: function (data) {
                  // beginEdit();
              },
//选中行可编辑
onClickRow: function (rowIndex, rowData) {
                  editingIndex = rowIndex;
                  if (lastIndex != rowIndex) {
                      if ($(this).datagrid('validateRow', lastIndex)) {
                          // $(this).datagrid('endEdit', lastIndex);
                          $(this).datagrid('beginEdit', rowIndex);

                          lastIndex = rowIndex;
                      } else {
                          $(this).datagrid('selectRow', lastIndex);
                          editingIndex = lastIndex;
                      }
                  }
              }

//开始编辑
      function beginEdit() {
          var $dg = $("#grid");
          var rows = $dg.datagrid('getRows');
          for (var i = 0; i < rows.length; i++) {
              $dg.datagrid('beginEdit', i);
          }
      }
//结束编辑
      function endEdit() {
          var $dg = $("#grid");
          var rows = $dg.datagrid('getRows');
          for (var i = 0; i < rows.length; i++) {
              $dg.datagrid('endEdit', i);
          }

      }   
//全选
   function checkall() {
          $("input[name=OnShip]").each(function () {
                  $(this).attr("checked", true);
          });
      }
//全消
      function removeall() {
          $("input[name=OnShip]").each(function () {
              $(this).attr("checked", false);
          });

      }




















0 0
原创粉丝点击