A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: dataset filter problem

  1. #1
    Flash Student rabidlemming's Avatar
    Join Date
    Mar 2003
    Location
    UK
    Posts
    382

    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

  2. #2
    Flash Student rabidlemming's Avatar
    Join Date
    Mar 2003
    Location
    UK
    Posts
    382
    any one ?

    I will wait for death with a smile and a big stick

  3. #3
    Flash Student rabidlemming's Avatar
    Join Date
    Mar 2003
    Location
    UK
    Posts
    382
    no really any one ? dam!! is it really that hard ?

    I will wait for death with a smile and a big stick

  4. #4
    Maya * ActionScript Addict DangerAhead's Avatar
    Join Date
    Jun 2000
    Location
    San Francisco
    Posts
    299
    No one is going to go through tons of code. What part of the code isn't working? Can you narrow it down?
    Geordie Martinez
    www.citizenparanoid.com | email

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center