rabid lemming
03-17-2005, 01:09 AM
Hi all,
I have this 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:
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 have this 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:
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