Page 1 of 2
Mapping to a Filtered data
Posted: Wed Mar 20, 2013 7:26 pm
by leonardo
In my app I have names of persons with their corresponding photos. I have 2 filtering pages. On one page I want to filter to a result page based on the match for a search name. On the other I want to filter to the result page based on the names that correspond to the first or last names of the alphabet clicked. I am having trouble mapping to get the names and pictures to display on the results page.
Mapping to a Filtered data
Posted: Wed Mar 20, 2013 7:49 pm
by Maryna Brodina
Could you clarify please what is the exact problem you have? Are there any errors in console?
Mapping to a Filtered data
Posted: Wed Mar 20, 2013 8:12 pm
by leonardo
No error. I have mapped to get all names and their pictures to show up. I'm asking how to map to get filtered results to display names and pictures only for the names matching the input for search in one case, or the names starting with the alphabet clicked for the other case.
Mapping to a Filtered data
Posted: Wed Mar 20, 2013 8:16 pm
by Maryna Brodina
Could you show us your mapping screenshot?
Mapping to a Filtered data
Posted: Wed Mar 20, 2013 8:47 pm
by leonardo
This is the start screen. The page having filtered result has no mapping.
Mapping to a Filtered data
Posted: Wed Mar 20, 2013 10:11 pm
by Maryna Brodina
Mapping to a Filtered data
Posted: Thu Mar 21, 2013 8:50 am
by Kateryna Grynko
Hello,
According to Tiggzi design, data is filtrated in Rest Service. Mapping is for displaying data only.
If you need to delete some items in mapping settings you can click "Add JS" or "Edit JS" in front of the filtering field:
Add the following JavaScript code:
codeif(value.indexOf("a") != -1) {
element.closest("table").hide();
}
return value;/code
All the data containing "a" will be hidden.
Mapping to a Filtered data
Posted: Thu Mar 21, 2013 7:53 pm
by leonardo
Yes, but in this case I'm navigating to another page to display the filtered list. I am getting all the names again on the other page. I have shared the project so you can examine it. Thanks.
Mapping to a Filtered data
Posted: Thu Mar 21, 2013 10:01 pm
by Maryna Brodina
1) On startScreen--searchButton--Click--Navigate to page should be the last event;
2) On Filtered page-- Load -- Run JavaScript replace alert codealert("Ho" +sid);/code with the next one codealert("Ho" +localStorage.getItem("sid"));/code
3) On startScreen and Filtered delete mapping to Request (it doesn't affect anything)
4) On Filtered page in restservice2 mapping from fn to filteredName --Text add next JS
codeif(value.indexOf(localStorage.getItem("sid")) === -1) {
element.closest("table").hide();
}
return value;/code
Mapping to a Filtered data
Posted: Fri Mar 22, 2013 6:39 am
by leonardo
Bravo! Works great.
Just for further understanding:
- When is it necessary to do a mapping to Request?
- If there are no match for the search I want to display a message on a Label component that there is no match. I know the label would first be set to visible off initially. How can I set the text to it and set it visible?
- Is there a place with help info on these kind of items?