简体   繁体   English

JSF中动态数据表的问题

[英]Issue with dynamic datatable in JSF

I have an issue with dynamic datatable in java. 我在Java中遇到动态数据表问题。 I am creating multiple dynamic datatable in one simple toggle panel. 我在一个简单的切换面板中创建了多个动态数据表。 Datatable is generated and getting displayed in the form(jsp page) properly. 数据表已生成并正确显示在表单(jsp页面)中。 Data is also populating in the table. 表格中也有数据。 When i click on any commandlink in the table it opens the modal panel but doesnt display any data. 当我单击表中的任何命令链接时,它将打开模式面板,但不显示任何数据。 when i refresh the page again then click on the commandlink the modal panel is showing the data. 当我再次刷新页面时,然后单击命令链接,模式面板将显示数据。

So the issue is first time when datatable generates and i click on any link required data never comes up in the modal panel in the first button click. 因此,问题是第一次生成数据表,并且我单击任何链接时,在第一次单击按钮的模态面板中就永远不会出现所需的数据。 but if i go back and again come back to the same page then required data comes up in the modalpanel. 但是,如果我返回并再次返回同一页面,则所需的数据会出现在模式面板中。 Please suggest me the solution for this. 请为我建议解决方案。

I have also noticed strange thing by comparing view source of the page loads first time and second time, datatable name comes up without form name in first time like DATA_TABLE_NAME and second time datatable name comes up with form name eg formName:DATA_TABLE_NAME 通过比较第一次和第二次加载页面的视图源,我也注意到了一件奇怪的事情,第一次出现的数据表名称没有表单名称,例如DATA_TABLE_NAME,第二次的数据表名称出现了表单名称,例如formName:DATA_TABLE_NAME

I have been copying the logs of the datatable twice. 我已经两次复制了数据表的日志。 This is the first Time: 这是第一次:

17:04:14,327 WARN  [HtmlLabelRenderer] Attribute 'for' of label component with id scopeItemsForm:taskMoreInfoNonScopePanelForm:j_id_jsp_151042
17:04:14,327 WARN  [HtmlLabelRenderer] Attribute 'for' of label component with id scopeItemsForm:taskMoreInfoNonScopePanelForm:j_id_jsp_151042
17:04:14,327 WARN  [HtmlLabelRenderer] Attribute 'for' of label component with id scopeItemsForm:taskMoreInfoNonScopePanelForm:j_id_jsp_151042
17:04:14,327 WARN  [HtmlLabelRenderer] Attribute 'for' of label component with id scopeItemsForm:taskMoreInfoNonScopePanelForm:j_id_jsp_151042
17:04:14,327 WARN  [HtmlLabelRenderer] Attribute 'for' of label component with id scopeItemsForm:taskMoreInfoNonScopePanelForm:j_id_jsp_151042
17:04:14,327 WARN  [HtmlLabelRenderer] Attribute 'for' of label component with id scopeItemsForm:taskMoreInfoNonScopePanelForm:j_id_jsp_151042
17:04:14,343 WARN  [HtmlLabelRenderer] Attribute 'for' of label component with id scopeItemsForm:taskMoreInfoNonScopePanelForm:j_id_jsp_151042
17:04:14,343 WARN  [HtmlLabelRenderer] Attribute 'for' of label component with id scopeItemsForm:taskMoreInfoNonScopePanelForm:j_id_jsp_151042
17:04:14,343 WARN  [HtmlLabelRenderer] Attribute 'for' of label component with id scopeItemsForm:taskMoreInfoNonScopePanelForm:j_id_jsp_151042
17:04:14,343 WARN  [HtmlLabelRenderer] Attribute 'for' of label component with id scopeItemsForm:taskMoreInfoNonScopePanelForm:j_id_jsp_151042
17:04:14,343 WARN  [UIComponentBase] WARNING: Component scopeItemsForm:j_id165 just got an automatic id, because there was no id assigned yet.
17:04:14,343 WARN  [UIComponentBase] WARNING: Component scopeItemsForm:j_id166 just got an automatic id, because there was no id assigned yet.
17:04:14,343 WARN  [UIComponentBase] WARNING: Component ST_DATATBL_ID_0:j_id167 just got an automatic id, because there was no id assigned yet
17:04:14,343 WARN  [UIComponentBase] WARNING: Component ST_DATATBL_ID_0:j_id168 just got an automatic id, because there was no id assigned yet
17:04:14,358 WARN  [UIComponentBase] WARNING: Component ST_DATATBL_ID_0:j_id169 just got an automatic id, because there was no id assigned yet
17:04:14,358 WARN  [UIComponentBase] WARNING: Component ST_DATATBL_ID_0:j_id170 just got an automatic id, because there was no id assigned yet
17:04:14,358 WARN  [UIComponentBase] WARNING: Component ST_DATATBL_ID_0:j_id171 just got an automatic id, because there was no id assigned yet
17:04:14,358 WARN  [UIComponentBase] WARNING: Component ST_DATATBL_ID_0:j_id172 just got an automatic id, because there was no id assigned yet
17:04:14,358 WARN  [UIComponentBase] WARNING: Component ST_DATATBL_ID_0:j_id173 just got an automatic id, because there was no id assigned yet
17:04:14,358 WARN  [UIComponentBase] WARNING: Component ST_DATATBL_ID_0:j_id174 just got an automatic id, because there was no id assigned yet
17:04:14,358 WARN  [UIComponentBase] WARNING: Component ST_DATATBL_ID_0:j_id175 just got an automatic id, because there was no id assigned yet
17:04:14,358 WARN  [UIComponentBase] WARNING: Component ST_DATATBL_ID_0:j_id176 just got an automatic id, because there was no id assigned yet
17:04:14,358 WARN  [UIComponentBase] WARNING: Component ST_DATATBL_ID_0:j_id177 just got an automatic id, because there was no id assigned yet
17:04:14,358 WARN  [UIComponentBase] WARNING: Component ST_DATATBL_ID_0:j_id178 just got an automatic id, because there was no id assigned yet
17:04:14,358 WARN  [UIComponentBase] WARNING: Component ST_DATATBL_ID_0:j_id179 just got an automatic id, because there was no id assigned yet

and here is the second time 这是第二次

16:49:34,264 WARN  [UIComponentBase] WARNING: Component scopeItemsForm:ST_DATATBL_ID_0:j_id105 just got an automatic id, because there was no id assigned yet. If this compo
16:49:34,264 WARN  [UIComponentBase] WARNING: Component scopeItemsForm:ST_DATATBL_ID_0:j_id106 just got an automatic id, because there was no id assigned yet. If this compo
16:49:34,264 WARN  [UIComponentBase] WARNING: Component scopeItemsForm:ST_DATATBL_ID_0:j_id107 just got an automatic id, because there was no id assigned yet. If this compo
16:49:34,264 WARN  [UIComponentBase] WARNING: Component scopeItemsForm:ST_DATATBL_ID_0:j_id108 just got an automatic id, because there was no id assigned yet. If this compo
16:49:34,279 WARN  [UIComponentBase] WARNING: Component scopeItemsForm:ST_DATATBL_ID_0:j_id109 just got an automatic id, because there was no id assigned yet. If this compo
16:49:34,279 WARN  [UIComponentBase] WARNING: Component scopeItemsForm:ST_DATATBL_ID_0:j_id110 just got an automatic id, because there was no id assigned yet. If this compo
16:49:34,279 WARN  [HtmlImageRendererBase] ALT attribute is missing for : null
16:49:34,279 WARN  [UIComponentBase] WARNING: Component scopeItemsForm:ST_DATATBL_ID_0:j_id111 just got an automatic id, because there was no id assigned yet. If this compo
16:49:34,295 WARN  [UIComponentBase] WARNING: Component scopeItemsForm:ST_DATATBL_ID_0:j_id112 just got an automatic id, because there was no id assigned yet. If this compo
16:49:34,295 WARN  [UIComponentBase] WARNING: Component scopeItemsForm:ST_DATATBL_ID_0:j_id113 just got an automatic id, because there was no id assigned yet. If this compo
16:49:34,295 WARN  [HtmlImageRendererBase] ALT attribute is missing for : null
16:49:34,295 WARN  [UIComponentBase] WARNING: Component scopeItemsForm:ST_DATATBL_ID_0:j_id114 just got an automatic id, because there was no id assigned yet. If this compo
16:49:34,295 WARN  [UIComponentBase] WARNING: Component scopeItemsForm:ST_DATATBL_ID_0:j_id115 just got an automatic id, because there was no id assigned yet. If this compo

First time HTML CODE comes like: 第一次HTML CODE如下:

<table class="rich-table " id="ST_DATATBL_ID_0" border="0" cellpadding="0" cellspacing="0" width="100%">
<colgroup span="12"></colgroup>
<thead class="rich-table-thead">
<tr class="rich-table-header  ">
<th class="rich-table-headercell " id="ST_DATATBL_ID_0:j_id107" width="20"></th>
<th class="rich-table-headercell " id="ST_DATATBL_ID_0:j_id108" width="2"></th>
<th class="rich-table-headercell " id="ST_DATATBL_ID_0:j_id109">ITEM #<img alt="" class="rich-spacer " height="1" id="ST_DATATBL_ID_0:j_id110" src="/pgsportal/a4j/g/3_3_3.Finalimages/spacer.gif.jsf" width="10%" />
<a href="#" id="ST_DATATBL_ID_0:j_id111" name="ST_DATATBL_ID_0:j_id111" onclick="A4J.AJAX.Submit('scopeItemsForm',event,{'status':'notrequired','similarityGroupingId':'ST_DATATBL_ID_0:j_id111','parameters':{'ST_DATATBL_ID_0:j_id111':'ST_DATATBL_ID_0:j_id111'} ,'containerId':'j_id0'} );return false;">

and second timme looks like: 第二个timme看起来像:

    <table class="rich-table " id="scopeItemsForm:ST_DATATBL_ID_0" border="0" cellpadding="0" cellspacing="0" width="100%">
    <colgroup span="12"></colgroup>
    <thead class="rich-table-thead"><tr class="rich-table-header  ">
    <th class="rich-table-headercell " id="scopeItemsForm:ST_DATATBL_ID_0:j_id107" width="20"></th><th class="rich-table-headercell " id="scopeItemsForm:ST_DATATBL_ID_0:j_id108" width="2"></th>
    <th class="rich-table-headercell " id="scopeItemsForm:ST_DATATBL_ID_0:j_id109">ITEM #
    <img alt="" class="rich-spacer " height="1" id="scopeItemsForm:ST_DATATBL_ID_0:j_id110" src="/pgsportal/a4j/g/3_3_3.Finalimages/spacer.gif.jsf" width="10%" />
    <a href="#" id="scopeItemsForm:ST_DATATBL_ID_0:j_id111" name="scopeItemsForm:ST_DATATBL_ID_0:j_id111" onclick="A4J.AJAX.Submit('scopeItemsForm',event,{'status':'notrequired','similarityGroupingId':'scopeItemsForm:ST_DATATBL_ID_0:j_id111','parameters':{'scopeItemsForm:ST_DATATBL_ID_0:j_id111':'scopeItemsForm:ST_DATATBL_ID_0:j_id111'} ,'containerId':'j_id0'} );return false;"><img src="../images/down_arrow.png" /></a>

Seems like you have an ID issue. 好像您有ID问题。

When creating a label you can set the for attribute to point at an input with the same id: 创建标签时,可以将for属性设置for指向具有相同ID的输入:

<label for="someId">
    <input name="someInput" id="someId"/>
</label>

Since you didn't post any HTML it's hard to say exactly but you might have a label with empty for : 既然你没有张贴任何HTML很难说清楚,但你可能有一个标签,空for

<label for="">

or the for is pointing at the wrong id: for指向错误的ID:

<label for="someId">
    <input name="someInput" id="someOtherId"/>
</label>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM