2011-01-07 92 views
0

我们可以在jqgrid中包含两个标题吗?一个有colModel,另一个没有colModel?jqgrid双标题

另外我有一个问题,当我点击一行,整个网格得到突出显示。我该如何解决这个问题?

CSS代码:

.cssclass{ 

      background-color : #EEEEEE; 
      font-family: Verdana, Arial, Helvetica, sans-serif; 
      font-size: 11px; 
      color: #0B0B61; 
      border: 0; 
      font-weight: bold; 
      text-align: center; 
      text-indent: 2pt; 
      padding-top: 2px; 
      padding-right: 2px; 
      padding-left: 2px; 
      left: expression(parentNode.parentNode.parentNode.parentNode.parentNode.scrollLeft); 
      position:relative; 
      z-index:10; 
      cursor: default; 
    } 

的jqGrid代码:

 $.ajax({ 

      type: "POST", 
      url: 'cfcs/index.cfc?method=getCols', 
      data: "", 
      dataType: "json", 
      success: function(result) 
      { 

       colM = eval("([" + result.COLMODEL + "])"); 
       colN = result.COLNAMES; 


       jQuery("#list").jqGrid({ 

        url:'cfcs/index.cfc?method=getDetails', 
        datatype: 'json', 
        mtype: 'POST', 

        colNames:colN, 
        colModel :colM, 
        height: 'auto', 
        hoverrows: true, 
        width: 1260, 
        shrinkToFit: false, 
        pager: jQuery('#pager'), 
        resizable: false, 
        rowNum: 25, 
        rowList: [25, 50, 100], 
        viewrecords: true, 
        jsonReader: { 
         root: "ROWS", //our data 
         page: "PAGE", //current page 
         total: "TOTAL", //total pages 
         records:"RECORDS", //total records 
         cell: "", 
         id: "0" 
        } 
        //loadComplete: function(data){alert('loaded');}, 
        //loadError: function(xhr,status,error){alert('error');} 
       }) 
       $("#list").setLabel("col1","<br><br>col1","cssclass"); 
       $("#list").setLabel("col2","<br><br>col1","cssClass"); 

       $("#list").jqGrid('navGrid','#pager',{ 
        edit:false, 
        add:false, 
        del:false, 
        search:true, 
        refresh: true, 
        searchtext:"Search", 
        refreshtext: "Refresh", 
        'cloneToTop':true 
       }); 
      }, 
      error: function(x, e) 
      { 
       alert(x.readyState + " "+ x.status +" "+ e.msg); 
      } 


     }); 

感谢。

+0

你的意思2标题行?或者是一个2行高的标题行? – Zac 2011-01-07 17:39:33

+0

@Zac。两个标题行。一个标题包含所有必需的列。我需要在第一个标题顶部的第二个标题包含一些列的日期范围。 – DG3 2011-01-07 17:51:44

回答

1

关于你的第二个问题。我建议你为所有网格行使用相同的ID。行ID必须是唯一的,那么你不会有descibed问题。

关于两个标题我不太明白你的意思。可以轻易地解释一下你的意思或者张贴照片。

0

您可能会考虑在每个日期范围内使用单独的网格,并将它们格式化为看起来像是在一起。

--------------------------------------------------- 
|   1/1/2010  |   1/2/2010  | 
--------------------------------------------------- 
| grid 1 header  | grid 2 header   | 
--------------------------------------------------- 

你可以并列GRID1的各种活动,并一起GRID2在GRID1所以选择行10 GRID2选择它。

您可能还想看看“高级”下的subgrid demos here,看看是否有适合您的数据的东西。


替代

阅读过您的意见后,我认为这可能是更接近你想要什么,只是改变了日期范围的单位。 alt text

.ui-jqgrid .ui-jqgrid-htable th div 
{ 
    height: auto; 
    padding: 5px 0px; 
}