Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / Flash / Data Integration / November 2005



Tip: Looking for answers? Try searching our database.

DataSet filterFunc return listed items

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
don Thomaso - 15 Nov 2005 13:09 GMT
Hi,
i'm writing a dataset filter. The user selects and deselcts items in a
checkbox group. Each checkbox-button in the group corresponds to a 'pType', see
code below. Would like the filter to return 'pType's based on the selection.
So, with my construct idea, the question is: how to tell the function to return
items that is within a list?

        myDataSet.filterFunc = function(item:Object) {
            myFilterID = String(evt_obj.target.selection.data);
            //return (item.pType == myFilterID); // OK
            //return (item.pType == 0 | item.pType == 1 | item.pType == 2 &item.active
== 1); // OK
            //return ((item.pType == 0 & item.active == 0) | (item.pType == 2)); // OK
            //
            // >>>>>>>>>>> HERES THE PROBLEM <<<<<<<<<<<<<<<<<
            //return (item.pType == [0, 1, 2] & item.active == 1); // NOT OK
            return (item.pType == [0, 1, 2]);
            // NO RESULT...
            //return ((item.pType == {0, 1, 2})); // NOT OK
        };

/T
don Thomaso - 15 Nov 2005 21:54 GMT
This, my own quick-dirty solution:
(Any one with a cleaner idea?)
/d T

function filterTheData() {
    //Called each time any checkbox button is clicked at the viewFilter panel.
    removeVisualItems();
    var myPs:Array = new Array();
    for (i=0; i<iKindArray.length; i++) {
        if (viewFilter["filter_"+i].selected) {
            myPs[i] = i;
        } else {
            myPs[i] = -1;
        }
        trace(myPs[i]);
    }
    myDataSet.filtered = false;
    myDataSet.filtered = true;
    myDataSet.filterFunc = function(item:Object) {
        if (viewFilter.filter_onlyOngoing.selected) {
            return ((item.pType == myPs[0] | item.pType == myPs[1] | item.pType ==
myPs[2] | item.pType == myPs[3] | item.pType == myPs[4] | item.pType == myPs[5]
| item.pType == myPs[6] | item.pType == myPs[7] | item.pType == myPs[8] |
item.pType == myPs[9] | item.pType == myPs[10]) && item.active == 1);
        } else {
            return (item.pType == myPs[0] | item.pType == myPs[1] | item.pType ==
myPs[2] | item.pType == myPs[3] | item.pType == myPs[4] | item.pType == myPs[5]
| item.pType == myPs[6] | item.pType == myPs[7] | item.pType == myPs[8] |
item.pType == myPs[9] | item.pType == myPs[10]);
        }
    };
    updateVisualItems();
}
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.