• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

inputRowSelect problem

 
Ina Bumstein
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello.
In my application I am trying to show the search result in dataTable. The difficulty is that the inputRowSelect should be disabled or hidden if InSelectedList column value equals 1. I tried to use render condition, but in this case I couldn't get the rows selected values.
Maybe, you could suggest me any solution?
Thanks in advance.
Ina Bumstein
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18212
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The easiest way is to not display ineligible data. The way you do that is to take into account that the GUI datamodel isn't necessarily the same things as the persistent datamodel and only include the rows from the persistent datamodel that you actually want displayed.

This is, of course, that you're talking about data coming back as row objects from a database, but the principle's the same regardless of the origin of your display data, so for simplicity's sake, I'll use that as an example.

The brute-force way is simply to create a new list object, and enumerate the original data, adding only the rows that are eligible for display. If you have lots of data, limit the display model to only the data for the current page display and handle data scrolling manually to reduce overhead.

Alternatively, for a DBMS ORM system, it might be easier in some cases to simply formulate a query that pre-filters the data and use the results of that instead.
 
Ina Bumstein
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for reply Tim.
I think that you misunderstand the question. I need to show all result, but those that InSelectedList=1 shouldn't have inputRowSelect column active or shown. For example:

inputRowSelect column 1 column2 InSelectedList
active word1 word2 0
not active word1 word2 1

Maybe you know how to do that?
Ina
 
Ina Bumstein
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unfortunately I couldn't understand you Bob. This is my sample code.
What I should change here that rowSelect1 would be shown only if varsearchrez.c3=1? Just usage of the rendered tag for hx:inputRowSelect coses that the hx:inputRowSelect is not working properly.

<h:dataTable id="tableSRez" value="#{SearchRezult.searchrez}" var="varsearchrez" styleClass="dataTable" headerClass="headerClass" footerClass="footerClass" rowClasses="rowClass1, rowClass2" columnClasses="columnClass1" border="0" cellpadding="0"cellspacing="2" rows="10" width="100%">
<h:column id="columnRowSelect">
<hx:inputRowSelect id="rowSelect1" styleClass="inputRowSelect"value="#{SearchRezult.selected}">
<f:param name="chsavid" id="param1" value="#{varsearchrez.savid}"></f:param>
</hx:inputRowSelect>
<f:facet name="header"></f:facet>
</h:column>
<h:column id="column0">
<f:facet name="header"><hutputText value="Column1"></hutputText>
</f:facet>
<hutputText value="#{varsearchrez.c1}"></hutputText>
</h:column>
<h:column id="column1">
<f:facet name="header"><hutputText value="Column2"></hutputText>
</f:facet>
<hutputText value="#{varsearchrez.c2}"></hutputText>
</h:column>
</h:dataTable>
 
Bob Good
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Change SearchRezult.searchrez class (whatever class you put in the List, add a method



then

<hx:inputRowSelect rendered="#{varsearchrez.showWithLink}" id="rowSelect1" styleClass="inputRowSelect" value="#{SearchRezult.selected}">

[ January 30, 2008: Message edited by: Bob Good ]
[ January 30, 2008: Message edited by: Bob Good ]
 
Ina Bumstein
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Bob,
As I mentioned in the beginning I tried to do exactly the same as you suggested, but using this method I couldn't get the rows selected. The param1 value is empty.
May be you know any other solution?
Thanks. Ina
 
Bob Good
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My solution was to the original statement:

the inputRowSelect should be disabled or hidden if InSelectedList column value equals 1

Your new problem:

but using this method I couldn't get the rows selected. The param1 value is empty.

Some miscommunication perhaps here.

To get the rows selected, in your acton method to handle the form submit button, iterate through the list:



Forget the f:param.


Also change this:

<hx:inputRowSelect rendered="#{varsearchrez.showWithLink}" id="rowSelect1" styleClass="inputRowSelect" value="#{varsearchrez.selected}">
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic