jQuery MiniUI

标题: datagrid行样式移除 [打印本页]

作者: stone1314    时间: 2015-7-9 10:39:16     标题: datagrid行样式移除

http://www.miniui.com/demo/#src=datagrid/drawcell.html

     .delstong
    {
      font-weight: bold;
    }
      这个是移除的样式


       grid.on("drawcell", function (e) {
                e.cellStyle = "font-weight: bold;";

        });

        grid.on("cellclick", function(e) {
                grid.removeRowCls(e.row, "delstong")
            });


我点击任意单元格 不能移除 行的效果,是什么原因?

作者: dforce    时间: 2015-7-9 11:02:30

一个是写在元素上的样式,一个是样式名,怎么可能移除
作者: stone1314    时间: 2015-7-9 11:21:30

dforce 发表于 2015-7-9 11:02
一个是写在元素上的样式,一个是样式名,怎么可能移除

         grid.on("load", function(e) {
                $.each(e.data, function(i) {
                  console.log(e.data);
                    grid.addRowCls(e.data, "delstong");
                });
            });

            grid.on("cellclick", function(e) {
              console.log(e.row);
                grid.removeRowCls(e.row, "delstong")
            });

这样写 也不灵?  该怎么写?

作者: dforce    时间: 2015-7-9 11:39:38

stone1314 发表于 2015-7-9 11:21
grid.on("load", function(e) {
                $.each(e.data, function(i) {
                ...
  1. grid.on("load", function (e) {
  2.         setTimeout(function(){
  3.             $.each(e.data, function (i)
  4.                 grid.addRowCls(e.data[i], "delstong");
  5.             });
  6.             },100)
  7.         });
复制代码

作者: stone1314    时间: 2015-7-9 11:42:35

dforce 发表于 2015-7-9 11:39

也可以这样

grid.on("drawcell", function(e) {
                console.log(e);
                var field = e.field;
                if (field == "FlowTitle") {
                    e.cellStyle = "width:100px;height:auto;word-break:break-all;word-wrap:break-word;white-space:pre-wrap;";
                }
                 e.rowCls = "delstong";
            });

不容易啊           
      




欢迎光临 jQuery MiniUI (http://miniui.com/discuss/) Powered by Discuz! X2