PDA

View Full Version : Filter a spry table on the field selected from a repeater list


Crippolini
04-24-2008, 09:19 PM
Using Dreamweaver, I am looking to find out how to link a spry repeat list (Select Drop-Down) to a Spry table.
I have created a repeat list (Select Drop-Down) using a distinct filter on a field in my XML data base :
The XML database is:
var ds2 = new Spry.Data.XMLDataSet("Data/NetballDatafeed190401.xml", "NetballList/NetballProducts/SubType",{sortOnLoad:"SubType",sortOrderOnLoad:"ascending",distinctOnLoad:true});

The drop down list is created by
<div spry:region="ds2">
<select name="select" spry:repeatchildren="ds2">
<option value="{SubType}">{SubType}</option>
</select>
</div>

I have a table which I want to show only the values on the table where the subType that matches the value from the select list.

This data is populated by:
var ds1 = new Spry.Data.XMLDataSet("Data/NetballDatafeed190401.xml", "NetballList/NetballProducts",{sortOnLoad:"ProductPrice",sortOrderOnLoad:"ascending"});

and is created by
div spry:region="ds1">
<table>
<tr>
<th>ProductName</th>
<th>ProductPrice</th>
<th>ImageURL</th>
<th>SubType</th>
</tr>
<tr spry:repeat="ds1">
<td>{ProductName}</td>
<td>{ProductPrice}</td>
<td><img src="{ImageURL}"/></td>
<td>{SubType}</td>
</tr>
</table>
</div>


I believe that I need to create a spry:Choose statement in the drop down list which runs a function that filters the DS1 XML data.

I beleive that The function need to look like

var myFilterFunc = function(dataSet, row, rowNumber)
{
some funtion here that filters ds1 on {SubType}.......
}

I will then need to run ds1.filter(myFilterFunc);

Any pointers or examples most welcome.

Awon
08-09-2011, 07:02 AM
Hello There

I come to know you about Filter Data from Table Using Select Option.

I have a url which can help you.

Click Here : http://www.raiseitsolutions.com/forum/viewtopic.php?f=27&t=152 (http://www.raiseitsolutions.com/forum/viewtopic.php?f=4&t=3&sid=d77033041ed4f76e339e14beda1d7b2c)

I hope it is enough for you.

Thank You

AWON