-
Flash Student
dataset filter problem
Hi all,
I have this code:
Code:
stop();
/* ------------------------------------------------------ */
/* Set Style */
/* ------------------------------------------------------ */
SearchBox.setStyle( "borderStyle", "inset" );
ListBox.setStyle( "borderStyle", "solid" );
InfoBox.setStyle( "borderStyle", "solid" );
ListBox.setStyle( "rollOverColor", 0xdae4f0 );
ListBox.setStyle( "selectionColor", 0x88aed3 );
ListBox.setStyle( "textRollOverColor", 0x000000 );
ListBox.setStyle( "textSelectedColor", 0xffffff );
ListBox.setStyle( "selectionDuration", 0 );
/* ------------------------------------------------------ */
/* ListBox Functions */
/* ------------------------------------------------------ */
ListBox.iconFunction = function( item ) {
var covType:String = item.data.coverage.attributes.type;
if( covType == "full" ) {
return "iconCovered";
} else if( covType == "partial" ) {
return "iconPartial";
} else {
return "iconNotCovered";
}
}
function fillBox() {
ListBox.removeAll();
xmlDataSet.refreshDestinations();
ListBox.sortItemsBy( "label", "ASC" );
ListBox.selectedIndex = 0;
}
/* ------------------------------------------------------ */
/* Navigation Functions */
/* ------------------------------------------------------ */
function gotoListItem( ind:Number ):Void {
ListBox.selectedIndex = ind;
ListBox.vPosition = ind;
InfoBox.refreshFromSources();
}
function gotoListAlpha( letter:String ):Void {
letter = letter.substr( 0, 1 ).toUpperCase();
ListBox.selectedIndex = 0;
while( ListBox.selectedItem.label.substr( 0, 1 ).toUpperCase()
< letter && ListBox.selectedIndex < ListBox.length - 1 ) {
ListBox.selectedIndex += 1;
}
gotoListItem( ListBox.selectedIndex );
}
function selectCoverage( option:String ):Void {
//xmlDataSet.filtered = false;
if( dataFilter == option ) {
dataFilter = "";
} else {
//xmlDataSet.filtered = true;
xmlDataSet.filterFunc = function( item:Object ):Boolean {
//trace( item.coverage.attributes.type == option );
return( item.coverage.attributes.type == option );
}
dataFilter = option;
}
xmlDataSet.filtered = false;
xmlDataSet.filtered = true;
//xmlDataSet.refreshDestinations();
ListBox.updateControl();
//fillBox();
}
/* ------------------------------------------------------ */
/* Event Handlers */
/* ------------------------------------------------------ */
var res = function( ev ) {
xmlDataSet.addSort( "alpha", ["name"], DataSetIterator.Ascending | DatasetIterator.CaseInsensitive );
fillBox();
}
/* ------------------------------------------------------ */
/* Commands On Load */
/* ------------------------------------------------------ */
var dataFilter:String;
xmlConnect.addEventListener( "result", res );
this.xmlConnect.trigger();
button code:
Code:
on( release ) {
selectCoverage( "full" );
}
And I am trying to use a sort function but its not working. Upon further investigation, it may be that the dataset is filtering properly, but the list isn't pulling in the new results. It seems to be pulling in all the dataset records, rather than just the filtered ones.
Any help is appreciated
Cheers
Rabid Lemming
I will wait for death with a smile and a big stick
-
Flash Student
any one ?
I will wait for death with a smile and a big stick
-
Flash Student
no really any one ? dam!! is it really that hard ?
I will wait for death with a smile and a big stick
-
Maya * ActionScript Addict
No one is going to go through tons of code. What part of the code isn't working? Can you narrow it down?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|