|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi guys i've been looking through adobes spry functions
and i found this script was being used to remove states that began with a certain letter. i've been wondering if any1 could help me in editting the script so if a button is pressed the only "alabama" state would show. heres the script [CODE] <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Multiple Filters Sample</title> <link href="../../css/samples.css" rel="stylesheet" type="text/css" /> <script language="JavaScript" type="text/javascript" src="../../includes/xpath.js"></script> <script language="JavaScript" type="text/javascript" src="../../includes/SpryData.js"></script> <script language="JavaScript" type="text/javascript" src="../../includes/SpryDataExtensions.js"></script> <script type="text/javascript"> <!-- var dsStates = new Spry.Data.XMLDataSet("../../data/states/states.xml", "states/state"); function ffAH(ds, row, index){ var c = row.name.charAt(0); return c >= 'A' && c <= 'H' ? null : row; }; function ffIP(ds, row, index){ var c = row.name.charAt(0); return c >= 'I' && c <= 'P' ? null : row; }; function ffQZ(ds, row, index){ var c = row.name.charAt(0); return c >= 'Q' && c <= 'Z' ? null : row; }; function ToggleFilter(enable, f) { RemoveAllFilters(); if (enable) dsStates.addFilter(f, true); else dsStates.removeFilter(f, true); } function RemoveAllFilters() { document.forms[0]["fAH"].checked = false; document.forms[0]["fIP"].checked = false; document.forms[0]["fQZ"].checked = false; dsStates.removeAllFilters(true); } --> </script> <style type="text/css"> <!-- .badge { float: left; margin: 4px; padding: 4px; text-align: center; background-color: #FFCC99; border-top: solid 1px #999999; border-left: solid 1px #999999; border-bottom: solid 1px #CCCCCC; border-right: solid 1px #CCCCCC; } label { font-weight: bold; } --> </style> </head> <body> <h3>Multiple Filters Sample</h3> <p>This page demonstrates how to use the multiple filter support for data sets.</p> <p>Here is a working example that uses multiple filters.</p> <div class="liveSample" style="float: left; margin-bottom: 4px;"> <form action=""> <label>Filter out 'A' - 'H': <input name="fAH" type="checkbox" value="" onclick="ToggleFilter(this.checked, ffAH);" /></label> <label>Filter out 'I' - 'P': <input name="fIP" type="checkbox" value="" onclick="ToggleFilter(this.checked, ffIP);" /></label> <label>Filter out 'Q' - 'Z': <input name="fQZ" type="checkbox" value="" onclick="ToggleFilter(this.checked, ffQZ);" /></label> <input type="button" value="Remove All Filters" onclick="RemoveAllFilters();" /> <input type="button" value="Remove A-H" onclick=" ToggleFilter(this, ffAH);" /> <input type="button" value="Remove I-P" onclick=" ToggleFilter(this, ffIP);" /> <input type="button" value="Remove Q-Z" onclick=" ToggleFilter(this, ffQZ);" /> </form> <p spry:region="dsStates" spry:repeatchildren="dsStates"> <span class="badge">{name}</span> </p> </div> <p><br style="clear: both;" /> </p> <p> </p> </body> </html> CODE] thanks ![]() |
|
#2
|
|||
|
|||
|
RE: Spry Filter Functions
Not sure if you still need this, but you could just make a function like the following:
function ffAlabama(ds, row, index){ return (row.name == "Alabama") ? row : null; }; Hope that helps. |
![]() |
| Viewing: Dev Shed Forums > Web Site Management > Scripts > Help modifying spry script |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|