0 Replies Latest reply on Sep 21, 2007 9:19 AM by Menace4258

    ArrayCollection Problems

      I have a datagrid with an ArrayCollection as a dataProvider. The AC has multiple XML fields in it, such as the following format.


      Now, I'm selecting an item in the datagrid and pulling the practices out of it and setting it as the dataprovider for a list. In this list you can add, remove or edit any option. Now heres the problem, if the practice list has 2 or more items in it, everything works perfect as expected. But if it has 0 or 1 items in it, I can't add anything. Here's my following code I've been using to test:

      if(selAdv.selectedLabel == "Activities"){
      Alert.show("Entering Activities Block...", "Alert");
      temp = arrAtt.getItemAt(dgAttorneys.selectedIndex).practice;
      Alert.show("Temp Declared and Initialized", "Alert");

      Alert.show("Item Selected -- Begin", "Alert");
      temp.setItemAt(strTemp, lstAdv.selectedIndex);
      Alert.show("Item Selected -- End", "Alert");
      } else {
      Alert.show("No Item Selected -- Begin", "Alert");
      Alert.show("No Item Selected -- End", "Alert");

      Sorry, for all the alerts, they're just there so I can tell where the code halts at. Now, with 2 or more items(whether 1 on the list is selected or not) I get all 4 Alerts as expected. However, if there's 0 or 1 item in the list, the only Alert I get is Alert.show("Entering Activities Block...", "Alert");

      I've been stuck on this all day yesterday, and now this morning I finally accepted being stumped and turned to the forums for help =( So, if anyone has any idea why this is happening or any suggestions/questions, please help me out. Much appreciated and thank you for your time.