Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Tree grid shows all nodes as leaves

    I'm populating a simple TreeGrid with the following data, which looks correct to me (via the dev console) but the TreeGrid shows it as just a list of end nodes with no hierarchical structure, and instead of showing the Name field it is showing the ID field (screen shot attached). I can't see what anything wrong with the data. The field names match the DataSource and I'm only using setDataSource on the TreeGrid, not listing any specific fields. I have a second tree grid that is defined the same way and is using a second datasource with the same fields and structure. It appears correct. ?
    Code:
    [
        {
            isDSResponse:true,
            invalidateCache:false,
            status:0,
            data:[
                {
                    NAME:"Apparel                  ",
                    ID:101,
                    PARENTID:0,
                    TYPE:"DIV",
                    CODE:1
                },
                {
                    NAME:"Mens Apparel             ",
                    ID:1010,
                    PARENTID:101,
                    TYPE:"DPT",
                    CODE:10
                },
                {
                    NAME:"Mens Tops                ",
                    ID:10100,
                    PARENTID:1010,
                    TYPE:"SUB",
                    CODE:100
                },
                {
                    NAME:"Mens T Shirts            ",
                    ID:100100,
                    PARENTID:10100,
                    TYPE:"CLS",
                    CODE:100
                },
                {
                    NAME:"Mens Formal Shirts       ",
                    ID:100101,
                    PARENTID:10100,
                    TYPE:"CLS",
                    CODE:101
                },
                {
                    NAME:"Mens Formal Shirts & Tie ",
                    ID:100102,
                    PARENTID:10100,
                    TYPE:"CLS",
                    CODE:102
                }
            ]
        }
    ]
    Attached Files

    #2
    Check your primaryKey and foreignKey declarations in the DataSource to be sure they are on the ID and PARENTID fields.

    Comment


      #3
      They look correct to me.
      Code:
      <DataSource ID="IPClstbHierarchyDS" dataFormat="iscServer"
      	serverType="sql" dbName="as400" tableName="IPClstbHierarchy"
      	serverConstructor="com.islandpacific.gui.server.customDataSource.IpClstbHierarchyDS">
      	<fields>
      		<field name="Name" type="text" canFilter="true">
      			<filterEditorProperties operator="iContains" />
      		</field>
      		<field name="ID" type="integer" primaryKey="true">
      			<filterEditorProperties operator="iStartsWith" />
      		</field>
      		<field name="ParentID" type="integer" rootValue="0"
      			foreignKey="IPClstbHierarchy.ID" />
      		<field name="Type" type="text" length="3">
      			<valueMap>
      				<value ID="DIV">Division</value>
      				<value ID="DPT">Department</value>
      				<value ID="SUB">Sub-department</value>
      				<value ID="CLS">Class</value>
      			</valueMap>
      		</field>
      		<field name="Code" type="integer" detail="true" />
      	</fields>
      </DataSource>

      Comment


        #4
        ParentID != PARENTID

        Comment


          #5
          Thanks. I didn't realize the field/column names had to match case. Thanks for the quick response.

          Comment

          Working...
          X