zoukankan      html  css  js  c++  java
  • jqGrid,样式

      1. 初始化的时候不加载数据设置datatype: 'local'

       1 $("#grid").jqGrid({
       2 url:"http://www.8qiu.cn",
       3 datatype:"local",
       4 //other options
       5 });

       2. 当要加载数据的时候把datatype改成json或者XML:

        $("#list").jqGrid('setGridParam',{datatype:'json'}).trigger('reloadGrid');

    3.如果不要jqgrid表头上的点击排序可以把对应的colModel中加属性sortable : false.

     4.如果要想显示jqgrid中的caption可以在css样式中加入如下(你可以发现.ui-jqgrid .ui-jqgrid-titlebar 的div块display是none,所以没显示)

    
    
    1 .ui-jqgrid .ui-jqgrid-titlebar
    2 {
    3 display:block;
    4 }
    5.如果要使用jqgrid中caption中文字居中显示
    1 gridComplete: function(){
    2              $('#list').closest("div.ui-jqgrid-view")
    3                 .children("div.ui-jqgrid-titlebar")
    4                 .css("text-align", "center")
    5                 .children("span.ui-jqgrid-title")
    6                 .css("float", "none");
    7         }
    
    

    6.当浏览器的大小改变时,jqgrid的宽度作为相应的改变

    
    
    
    
    1 gridComplete: function(){
    2             $(window).resize(function(){ 
    3                 var winwidth=$(window).width()*0.5; //这里的0.5可以自己定
    4             $("#list").setGridWidth(winwidth);
    5             });
    6             
    7         }
    
    

    7.jqgrid关于日期格式化在colModel中添加

    
    
    1 formatter:'date',
    2 formatoptions:{srcformat:'Y-m-d H:i',newformat:'Y-m-d'}







  • 相关阅读:
    shell遍历文件夹并执行命令
    安装PIL的坑
    iptables不小心把127.0.0.1封了,导致redis连不上
    python读取中文
    不要在基类析构函数中调用纯虚函数,否则运行时会报错“pure virtual method called”
    阿里云64位centos6.3系统上编译安装redis
    Git
    Easy Mock
    Sortable
    几个框架
  • 原文地址:https://www.cnblogs.com/wushuishui/p/4350937.html
Copyright © 2011-2022 走看看