I am getting some freaky things going on with the dataGrid component. It worked flawlessly in one application and now it's freaking out in another giving me an error code: RecordSet warning 104: getItemAt(x) index out of range. I have CF returing a query that has two records - the grid is displaying the records and then the Output window is displaying this error.
Here is the code
function getProjectData_Result(result) {
_root.contentPlaceholder_mc.projectWelcomeTxt.text = "You currently have ("+result.getLength()+") active program(s):";
_root.contentPlaceholder_mc.projectGrid.setChangeHandler("getProjectData");
trace("Changed to getProjectData");
_root.contentPlaceholder_mc.projectGrid.removeAllColumns();
configureGrid();
_root.contentPlaceholder_mc.projectGrid.setDataProvider(result);
_root.contentPlaceholder_mc.projectGrid.setChangeHandler("addTeachers");
trace("Changed to addTeachers");
}
function configureGrid() {
// basic configuration methods
// make the columns using the DB's field names
_root.contentPlaceholder_mc.projectGrid.setColumns("pk_projectID", "projectTitle");
// set row count and column widths
_root.contentPlaceholder_mc.projectGrid.setRowCount(4);
_root.contentPlaceholder_mc.projectGrid.getColumnAt(0).setWidth(40);
// rename the columns
_root.contentPlaceholder_mc.projectGrid.getColumnAt(0).setHeader("ID");
_root.contentPlaceholder_mc.projectGrid.getColumnAt(1).setHeader("Project Title");
// make the rows alternate colors
_root.contentPlaceholder_mc.projectGrid.alternateRowColors(0x99ccff, 0xffffcc);
}
function addTeachers() {
trace("At the add Teachers");
trace("Past");
}
Here's what the output window gives me:
At CheckUser
Changed to getProjectData
RecordSet warning 104: getItemAt(2) index out of range
Changed to addTeachers
RecordSet warning 104: getItemAt(2) index out of range
RecordSet warning 104: getItemAt(3) index out of range
RecordSet warning 104: getItemAt(2) index out of range
RecordSet warning 104: getItemAt(3) index out of range
If I click on the headers in the grid - it adds 4 more:
RecordSet warning 104: getItemAt(2) index out of range
RecordSet warning 104: getItemAt(3) index out of range
RecordSet warning 104: getItemAt(2) index out of range
RecordSet warning 104: getItemAt(3) index out of range
Then - after I change the setChangeHandler to addTeachers - when I click on the record - it never gets there. But the funny thing is that it did get there a few times - but never got past the first trace call.
I have used this same basic code before and it works. I can't understand what the problem is. I found a few things on google when I put the error code in but they returned something in another language that didn't translate well - but it had something in there about updating the netdebug.as - but I can't find an update for that anywhere.
Basicly - I need some serious help here as I have to get this out the door.
yitian - 26 Dec 2003 09:26 GMT
Hi digiwake,
You've mentioned about your query returned 2 records, so I guess you should getItem() until 1 only, as ActionScript starts from 0.
Regards,
Yitian
myurl