Hey all, I have been working on a sample app using CF and Flex 2.
and so far its working smooth...Until I run across a query that has
no records in it. I have it take the results and bind them to a
datagrid, this is the error it gives me:
RangeError: Index '0' specified is out of bounds
at mx.collections::ListCollectionView/getItemAt()
at
mx.collections::ListCollectionView/http://www.macromedia.com/2005/act
ionscript/flash/proxy::getProperty()
at
mx.rpc::AbstractInvoker/http://www.macromedia.com/2005/flex/mx/intern
al::processResult()
at
mx.rpc::AbstractInvoker/http://www.macromedia.com/2005/flex/mx/intern
al::resultHandler()
at flash.events::EventDispatcher/dispatchEvent()
at mx.rpc::Producer/acknowledge()
at C:\dev\enterprise_beta1\frameworks\libs\framework.swc
(mx/core/mx_internal)$35::NetConnectionMessageResponder/result()
here is the function that is executed when the remoteobject gets a
result:
import mx.rpc.events.*;
import mx.collections.ArrayCollection;
public var LogLength:String;
public var LogName:String;
[Bindable]
public var LogData:ArrayCollection;
public function DGResults(){
LogData = LogDataSvc.CFLogToQuery.result;
LogLength = LogData.length.toString();
LogName = [EMAIL PROTECTED]();
t1.text = LogLength;
if (LogData.list.length.toString() != '0'){
mainpanel.title = 'CFLogView | ' + LogName + ' - ' +
LogLength + ' records found';
dglogresults.dataProvider = LogData;
}
else {
dglogresults.dataProvider = "";
mainpanel.title = 'CFLogView';
}
}
is there some sort of try/catch I can run or something to make it
stop telling me this error? I'd prefer it to just set the
dataprovider to null so nothing shows up rather than tell me that
there is nothing in the array...I don't know what to do here. Any
Suggestions?
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/