7 Replies Latest reply on Sep 7, 2008 5:28 AM by Newsgroup_User

    Comma prompt error in datagrid

    fypstudent
      I had created a timetable in the datagrid. The datagrid is able to display individual staff's tiimetable. However, I was prompt an error when I click on this particular staff to view the class schedule. I found out that the error is caused by a comma in the rows in the database while the other individual staff's timetable works fine without any comma found in the the rows.

      The Error
      http://i192.photobucket.com/albums/z63/nellehs/error.jpg

      Particular Row
      http://i192.photobucket.com/albums/z63/nellehs/databasecopy.jpg

      Codes in Flex
      <mx:DataGrid x="10" y="155" dataProvider="{timetable}" width="1004" height="383" id="tableCol">
      <mx:columns>
      <mx:DataGridColumn headerText="Day" dataField="day" width="50"/>
      <mx:DataGridColumn headerText="Start" dataField="start" width="50"/>
      <mx:DataGridColumn headerText="End" dataField="end" width="50"/>
      <mx:DataGridColumn headerText="Subject" dataField="mod"/>
      <mx:DataGridColumn headerText="Room" dataField="room"/>
      </mx:columns>
      </mx:DataGrid>

      Must I edit the codes in the PHP file or the codes in Flex?
        • 1. Re: Comma prompt error in datagrid
          SujitG Level 2
          Hi,

          I don't think the problem is with the the DataGrid. I think the problem is in the ResultEvent.RESULT handler of the HTTPService call you are invoking. I think you are assigning event.result to object of type ArrayCollection, where as the object returned is not of type ArrayCollection.

          Please check out if there is any place where you are assigning a normal Object type to ArrayCollection type.

          Hope this helps.
          • 2. Re: Comma prompt error in datagrid
            fypstudent Level 1
            Hi, I do not sure how to check if i assign a normal object type to the array collection. The codes are attached below. Did i did wrongly to call the array out?
            • 3. Re: Comma prompt error in datagrid
              Level 7

              "fypstudent" <webforumsuser@macromedia.com> wrote in message
              news:g9rfq4$91g$1@forums.macromedia.com...
              > Hi, I do not sure how to check if i assign a normal object type to the
              > array
              > collection. The codes are attached below. Did i did wrongly to call the
              > array
              > out?
              >
              >
              > /Array Collection for timetable
              > [Bindable]
              > private var timetable:ArrayCollection = new ArrayCollection();
              >
              > private function timetableHandler(event:ResultEvent):void
              > {
              > timetable = event.result.staffsignage.timetable;
              > }
              >
              > //HTTP Service for calling timetable
              > <mx:HTTPService id="allData"
              > url=" http://localhost/timetableTest/src/scripts/timetable.php"
              > result="timetableHandler(event)" method="POST" showBusyCursor = "true">
              > <mx:request xmlns="">
              > <staffid>{selectedProfileID.staffid}</staffid>
              > </mx:request>
              > </mx:HTTPService>

              Have you done anything on the web service side to ensure that the object
              coming back is an ArrayCollection? I think you need to use something like
              JSON to make that happen, but I'm not a webservice person.

              Are you sure that you ought to be using a HTTPService here? Maybe what you
              need is HTTPRequest instead.


              • 4. Re: Comma prompt error in datagrid
                fypstudent Level 1
                Hi, I realised the error is not cause by the comma in the data in the database. It is because the array collection only retrieve a row from the database; that is why the error prompts. This is because when I added a new row in the selected staff, the error seems to be gone. Thus, what should I do to remove the error?

                Thanks for all the suggestions.
                • 5. Re: Comma prompt error in datagrid
                  Level 7

                  "fypstudent" <webforumsuser@macromedia.com> wrote in message
                  news:g9t4nc$4f9$1@forums.macromedia.com...
                  > Hi, I realised the error is not cause by the comma in the data in the
                  > database.
                  > It is because the array collection only retrieve a row from the database;
                  > that
                  > is why the error prompts. This is because when I added a new row in the
                  > selected staff, the error seems to be gone. Thus, what should I do to
                  > remove
                  > the error?

                  I think there might me something about this in the flexcoders yahoo group
                  archives, or you could ask on there.


                  • 6. Re: Comma prompt error in datagrid
                    fypstudent Level 1
                    Hi,
                    Do you know where to search for the answer in the Yahoo Group Flexcoder?
                    • 7. Re: Comma prompt error in datagrid
                      Level 7

                      "fypstudent" <webforumsuser@macromedia.com> wrote in message
                      news:g9voe0$rv2$1@forums.macromedia.com...
                      > Hi,
                      > Do you know where to search for the answer in the Yahoo Group Flexcoder?

                      Try using the Text Input labeled simply "Search" and pressing the Search
                      button next to it.