Hello
I'd like to have a Filter-Combobox for my DataTable row which has numbers as data. Is it possible to have combobox-entries like:
in my "String-row" ?
Thanks for help
-- Bitrose
Hello,
Yes, you can specify a function that will return the number ranges. Here is an example with part of JSP page:
<q:dataTable var="person"
value="#{PeopleList.person}"
rowKey="#{person.id}">
<q:column filterExpression="#{person.name}"
filterKind="searchField">
<f:facet name="header">
<h:outputText value="Name" ></h:outputText>
</f:facet>
<h:outputText value="#{person.name}" ></h:outputText>
</q:column>
<q:column filterExpression="#{PeopleList.personAgeRange}" filterKind="comboBox">
<f:facet name="header">
<h:outputText value="Age"></h:outputText>
</f:facet>
<h:outputText value="#{person.age}" ></h:outputText>
</q:column>
</q:dataTable>
And getPersonAgeRange() method from ÂPeopleList backing bean:
public String getPersonAgeRange() {
Person person = (Person) FacesUtil.getRequestMapValue("person");
int age = person.getAge();
if (age <= 10)
return "0-10";
if (age <= 20)
return "11-20";
if (age <= 30)
return "21-30";
if (age <= 40)
return "31-40";
return ">40";
}Currently, you cannot directly delete entries from the filter field. If there is at least one empty cell in the column, these entries will be added automatically. You can only change text for these entries. We will consider providing an option to hide these entries.
Regards,
Tatyana
Hi Tatyana
Thanks a lot! It's exactly what I'm looking for.
I have 2 other questions regarding Filterboxes:
-How can I define the width of a filter-box?
- Is there a possibility to influence the order of the above ComboBox items. E.g.
if I wonna have:
<-300%
-299% to -200%
-199% to -100%
>-100%
and not
-199% to -100%
-299% to -200%
>-100%
<-300%
Thanks
-- Bitrose
bitrose question added
Message was edited by: Bitrose
You cannot explicitly change the width of a filter field. Its width is equal to the column width. You can change the column width with the Âstyle attribute of the <q:column> tag.
Regards,
Tatyana
You can use filterValues attribute to retrieve list of filter values in order you need. Here is an example:
..
<q:column filterExpression="#{PeopleList.personAgeRange}" filterKind="comboBox"
filterValues="#{PeopleList.ageRanges}">
<f:facet name="header">
<h:outputText value="Age"></h:outputText>
</f:facet>
<h:outputText value="#{person.age}" ></h:outputText>
</q:column>
..
And method from ÂPeopleList backing bean:
public List getAgeRanges(){
myAgeRanges.add(">40");
myAgeRanges.add("31-40");
myAgeRanges.add("21-30");
myAgeRanges.add("11-20");
myAgeRanges.add("0-10");
return myAgeRanges;
}
Thanks for your answer. Unfortunately, I still get it in the wrong order:
In my Backing-Bean:
public String getReturnRange() {
myType node = (myType) FacesUtil.getRequestMapValue("results");
double ret = node.getReturn();
if (ret 30%");
return myReturnRanges;
}
The ComboBox items are in this wrong order:
10% bis 20%
0% bis 10%
< 0%
30%
20% bis 30%
What did I wrong?
Cheers,
--Bitrose
Hello,
Yes, you are right. It was my mistake, in the current version of the QuipuKit library there is no possibility to change the order of entries in the filter field. But we will provide it in one of our next minor updates of QuipuKit.
Regards,
Tatyana
This feature will be available in the QuipuKit library version 1.0.1.
Regards,
Tatyana