7 Replies Latest reply on Dec 7, 2010 5:08 AM by saisri2k2

    DataGrid

    AMIR820321548863 Level 1

      Hi

       

      I have build an application with a datagrid.

      The application get an xml file from server.

      The xml receive as an arraycollection that is converted to XMLLIST and then converted to XML.

       

      The xml file look something like this

      Header 1Header 2

      <root>
        <forms>
          <form>
            <elid>
              <female>1</female>
              <good>0</good>
              <elid1>ELID</elid1>
              <UserIndex>1</UserIndex>
              <smart>5</smart>
              <positive>4</positive>
              <male>1</male>
              <nervous>5</nervous>
              <decisive>5</decisive>
              <strong>4</strong>
              <active>7</active>
              <healthy>3</healthy>
              <aggressive>5</aggressive>
              <sociable>3</sociable>
              <winner>2</winner>
              <sexy>5</sexy>
              <like>0</like>
              <fix>0</fix>
              <job>0</job>
              <buycar>0</buycar>
              <help>0</help>
            </elid>

            <elid>
              <female>1</female>
              <good>0</good>
              <elid1>ELID</elid1>
              <UserIndex>1</UserIndex>
              <smart>5</smart>
              <positive>4</positive>
              <male>1</male>
              <nervous>5</nervous>
              <decisive>5</decisive>
              <strong>4</strong>
              <active>7</active>
              <healthy>3</healthy>
              <aggressive>5</aggressive>
              <sociable>3</sociable>
              <winner>2</winner>
              <sexy>5</sexy>
              <like>0</like>
              <fix>0</fix>
              <job>0</job>
              <buycar>0</buycar>
              <help>0</help>
            </elid>

            <UserInformation>
              <DATE>5/12/2010</DATE>
              <FirstName>AMIR</FirstName>
              <LastName>AUDI</LastName>
              <Gender>0</Gender>
              <DateOfbirth>0</DateOfbirth>
              <Resident/>
              <PlaceOfBirth/>
              <MotherTongue/>
              <Job/>
              <Education/>
            </UserInformation>
          </form>
        </forms>
      </root>



       

      My XML file which I use as data provider for the DATAGRID is

      xmlData = tmpXML.root.forms.form;

       

      To get the data in the tag I wrote

      dataField="elid.elid1"

      dataField="elid.female"... and so on.

       

      Instead of getting the inside of the tag inside the DataGridColumn, I got

      <elid1>ELID</elid1>

      <elid1>ELID</elid1>

      In every column I all the tags instead of the data inside.

       

      Does any one know how to solve the problem?

       

      Thanks

      AMIR

        • 1. Re: DataGrid
          saisri2k2 Level 4

          try dataField="elid.elid1[0]"

           

          ignore the above line, use the tmpXML.root.forms.form.elid

           

          in the data field use dataField="elid1"

           

          Message was edited by: saisri2k2

          • 2. Re: DataGrid
            Devtron Level 3

            ^ Beautiful. that should work!


            • 3. Re: DataGrid
              saisri2k2 Level 4

              You should be marking this as answered

              • 4. Re: DataGrid
                AMIR820321548863 Level 1

                Hi

                 

                Indeed that will work, however I will not be able to get the information UserInformation from the XML file on the same datagrid.

                I need to show all of this data on a single datagrid, with DataGridColumn for each tag.

                 

                Any ideas how do that?

                 

                Thanks

                • 5. Re: DataGrid
                  saisri2k2 Level 4

                  UserInformation as a separate row? or as common for all the data in differnt columns?

                  • 6. Re: DataGrid
                    AMIR820321548863 Level 1

                    same row differnt columns

                    • 7. Re: DataGrid
                      saisri2k2 Level 4

                      After you get the data you have to adjust it so that it wil look something like this.

                       

                      <elid>
                              <female>1</female>
                              <good>0</good>
                              <elid1>ELID</elid1>
                              <UserIndex>1</UserIndex>
                              <smart>5</smart>
                              <positive>4</positive>
                              <male>1</male>
                              <nervous>5</nervous>
                              <decisive>5</decisive>
                              <strong>4</strong>
                              <active>7</active>
                              <healthy>3</healthy>
                              <aggressive>5</aggressive>
                              <sociable>3</sociable>
                              <winner>2</winner>
                              <sexy>5</sexy>
                              <like>0</like>
                              <fix>0</fix>
                              <job>0</job>
                              <buycar>0</buycar>
                              <help>0</help>

                              <UserInformation>
                                     <DATE>5/12/2010</DATE>

                                     <FirstName>AMIR</FirstName>
                                    <LastName>AUDI</LastName>

                                    <Gender>0</Gender>
                                    <DateOfbirth>0</DateOfbirth>

                                    <Resident/>
                                    <PlaceOfBirth/>

                                    <MotherTongue/>
                                    <Job/>

                                    <Education/>
                            </UserInformation>
                            </elid>

                       

                      later in the datagrid you can say dataField = 'UserInformation.FirstName'