2014-08-29 49 views
0

我正在使用jqGrid 4.4.1。我使用JSON对象在js文件中本地填充jqGrid。标题没有出现在jqGrid中

var $myGrid = $('#myTable'); 

function initializeGrid(data) { 
$myGrid.jqGrid({ 
    data:data, 
    datatype: "local", 
    . . . 
    . . . 
    caption : 'Title' 
}); 
} 

我将此函数作为将向此函数输入JSON数据的ajax调用的回调调用。网格填充正确,但标题不会来。我甚至无法在jqGrid上看到标题栏。

我已经尝试在chrome控制台上使用以下命令手动设置标题,但仍然无法使用。

$myGrid.jqGrid('setGridParam','caption','Title'); 

我需要为此做任何特定的配置吗?

+2

[试试这个](http://stackoverflow.com/questions/8681058/jqgrid-setting-caption-dynamically) – 2014-08-29 10:03:38

回答

0

我发现这个问题的原因。在我的一个css中有一行导致这个问题

.ui-jqgrid-title{ visibility:hidden} 

感谢您的答案!

0

这对我的作品。尝试这个

jQuery("##myTable").jqGrid({ 

      url: '.....' 
      datatype: 'json', 
      mtype: 'POST', 
      postData: { 
       documentUserLinkString: '@Model.documentUserLinkString' 
      }, 

      // Paging 
      toppager: false, 
      pager: $("#ReciverNamepager"), 
      rowNum: 15, 
      gridview: true, 

      // Default sorting 
      sortname: "FullName", 
      sortorder: "asc", 
      gridComplete: CheckEmptyData, 
      emptyrecords: 'File is not yet shared', 
      emptyDataText: '<div class="errordiv">File is not yet shared</div>', 

      caption: "File Reciver Name List"// this is 
     }).navGrid({ edit: false, add: false, del: false, refresh: true, search: false }); 

    });