Welcome, Guest
  • Author Topic: data set filter problem ?  (Read 2718 times)

    rabid lemming

    • Server what's that
    • *
    • Posts: 3
    • Flash Student
      • MSN Messenger - lemming29@hotmail.com
      • View Profile
      • Flash Tutorials
      • Email
    data set filter problem ?
    « on: 03/16/05, 20:16 »
    Hi all,

    I have this code:

    Code: [Select]
    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: [Select]
    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

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re: data set filter problem ?
    « Reply #1 on: 03/17/05, 04:17 »
    Do you have bindings between the ListBox and the dataset? What's this ListBox.updateControl function?

    Jorge

    arlyn9391

    • Server what's that
    • *
    • Posts: 1
      • View Profile
      • Email
    Re: data set filter problem ?
    « Reply #2 on: 05/22/09, 03:43 »
    Hi all,

    I have this code:

    Code: [Select]
    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: [Select]
    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


    If you having a problem with your data set filter, that is really a big problem.



    _________________
    Aprilaire