jsf - How do I make p:dataTable in ui:composition more reusable? -
i'm using primefaces 3.4 , have series of .xhtml datatables on page. use 1 .xhtml tables on page , use ui:param when including .xhtml each kind of datatable. if have following code fragment:
<p:datatable id="invoicetable" emptymessage="pick category drop down" rows="10" var="invoice" value="#{editoruibean.invoices}" scrollable="true" scrollheight="180" editable="true" rowkey="#{invoice.seqid}" ...
so imagine have .xhtml invoices, 1 cash tendered, 1 sales taxes, etc , each .xhtml identical except property in backing bean , ids , variable names. if genericify fragment above, what_do_i_replace_this_with make work?
<p:datatable id="#{tableid}" emptymessage="#{emptymessage}" rows="10" var="#{rowid}" value="#{editoruibean[dataproperty]}" scrollable="true" scrollheight="180" editable="true" rowkey="#{what_do_i_replace_this_with[rowkey]}" ...
so if code included in editabletable.xhtml , use follows:
... <ui:include src="editabletable.xhtml"> <ui:param name="tableid" value="invoiceid"/> <ui:param name="emptymessage" value="pick category drop down"/> <ui:param name="rowid" value="invoice"/> <ui:param name="dataproperty" value="invoices"/> <ui:param name="rowkey" value="seqid"/> ... </ui:include> ....
so asking, how variable invoice rowid instead of string "invoice"? in jsf or primefaces there eval() function? can eval(rowid)[rowkey]?
forgive me not wording question well, jsf/primefaces newbie , don't know terminology.
thanks in advance.
Comments
Post a Comment