[英]JQ Grid Header not changing dynamically
In a jqGrid I have to change header of a column on condition. 在jqGrid中,我必须根据条件更改列的标题。 It should happen when the page is loaded.
页面加载时应该会发生。 '
progAccessSearchResults
' is the table id. “
progAccessSearchResults
”是表ID。 ' Start Date
' is the column header. “
Start Date
”是列标题。 {name:'startDate', index:'B2B_START_DT', width: 90, resizable: false, hidden : hideStartDate},
is the code for it. {name:'startDate', index:'B2B_START_DT', width: 90, resizable: false, hidden : hideStartDate},
是它的代码。 While loading the page, if some condition is satisfied, I want to change the header to 'Access Start Date' instead of 'Start Date' . 加载页面时,如果满足某些条件,我想将标题更改为'Access Start Date'而不是'Start Date'。 I tried with many examples given in Stackoverflow .
我尝试了Stackoverflow中给出的许多示例。 But it is not working for me.
但这对我不起作用。 I tried example like
我试过像
$(tableId).jqgrid("setLabel", 0, "BBBBB");
$(tableId).setLabel("ColumnName", "AAAAA");
$(tableId).jqgrid("setLabel", "ColumnName", "BBBBB");
I tried with 我尝试过
jQuery(document).ready(function() {
if (#{program.lkpProgType == lookupManager.lkpIdByName('MOVIE') })
$('#progAccessSearchResults').jqGrid("setLabel", "startDate", "Access Start Date");
});
Inside gridComplete method, I kept 在gridComplete方法内部,我一直
if (#{program.lkpProgType == lookupManager.lkpIdByName('MOVIE') })
$('#progAccessSearchResults').jqGrid("setLabel", "startDate", "Access Start Date");
Nothing worked. 没事。 Please help me.
请帮我。
You made typing error I think. 我认为您输入错误。
jqgrid
should be changed to jqGrid
: jqgrid
应该更改为jqGrid
:
$(tableId).jqGrid("setLabel", "startDate", "Access Start Date");
The callback beforeProcessing
could be probably the best place for testing the condition of data returned from the server. 回调
beforeProcessing
可能是测试从服务器返回的数据的状况的最佳位置。 You can test some conditions and use $(this).jqGrid("setLabel", "startDate", someCondition ? "Access Start Date": "Start Date");
您可以测试一些条件并使用
$(this).jqGrid("setLabel", "startDate", someCondition ? "Access Start Date": "Start Date");
to change the column header. 更改列标题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.