29. juli 2005 - 13:25Der er
8 kommentarer og 1 løsning
Søge i Array uden at være strict søgning? EKSTRA
Ok drenge! Tak for sidst.. Har et DataSet, (Array).. I dette vil jeg gerne bruge førnævnte søgefunktion i forbindelse med et tekstfelt der søger igennem ved hver enkelt indtastning af bogstaverne, "instant search" og filtrere f.eks navne fra der ikke møder kriteriet.
Har jeres smukke funktion men her er det så:
Dataset har to metoder: .filtered og .filterFunc..
Usage dataSet.filtered
Description Property;
a Boolean value that indicates whether the data in the current iterator is filtered. The default value is false.When this property is true, the filter function specified by DataSet.filterFunc is called for each item in the
specifies a function that determines which items are included in the current view of the collection. When DataSet.filtered is set to true, the function assigned to this property is called for each record (transfer object) in the collection. For each item that is passed to the function, it should return true if the item should be included in the current view, or false if the item should not be included in the current view.When changing the filter function on a data set, you must set the filtered property to false and then true again in order for the proper modelChanged event to be generated. Changing the filterFunc property won’t generate the event.Also, if a filter is already in place when the data loads in (modelChanged or updateAll), the filter isn’t applied until filtered is set to false and then back to true again.
Eksempel:
employee_ds.filtered = true; employee_ds.filterFunc = function(item:Object) {// filter out employees who are managers... return(item.empType != "management"); }
Kan det lade sig gøre at flette søge funktionen ind i .filterFunc så jeg derved har et "instant search" felt der hamrer igennem den kolonne jeg specificerer?
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.