Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

Treegrid not displaying nodes from datasource

$
0
0
Hello there,

I am using SmartClient Version: v10.0p_2015-05-08/PowerEdition Deployment (built 2015-05-08) with FF26.

I am trying to display two treegrid where user can drop nodes nodes from left to right treegrid only. The left treegrid is getting its data from a simple datasource file where i have id and one foreign key field. But the right treegrid is getting its data from a datasource which i have around 3 foreign key and after reading the TreeDataBinding, I made some changes to my code i.e. I added the setParentIdField/setIdField. But still no data is getting loaded in this treegrid.
In the code below I am trying to tell it to use load the product names which is the parent and the child. i mean the product names dont have any parent.
Below are my 2 datasource file and the treegrid.

Code:

DataSource ds = DataSource.get("distributorDS");
DataSource dsproduct = DataSource.get("productDS");
                       
        final DistributorTreeGrid treeGrid = new DistributorTreeGrid();
        treeGrid.setDragDataAction(DragDataAction.MOVE); 
        treeGrid.setDataSource(ds);
        treeGrid.addDrawHandler(new DrawHandler() { 
            public void onDraw(DrawEvent event) { 
                treeGrid.fetchData(); 
            } 
        }); 
       
        Tree tree = new Tree();
        //tree.setRootValue("id");
        tree.setModelType(TreeModelType.PARENT);
                tree.setParentIdField("id");
                tree.setIdField("id");
                tree.setNameProperty("name");
               
                final CompanyTreeGrid companytreeGrid = new CompanyTreeGrid();
                companytreeGrid.setDataProperties(tree);
                companytreeGrid.setData(tree);
                companytreeGrid.setDataSource(dsproduct);
                companytreeGrid.setAutoFetchData(true);
                /*companytreeGrid.addDrawHandler(new DrawHandler() { 
            public void onDraw(DrawEvent event) { 
                    companytreeGrid.fetchData(); 
            } 
        });*/

Code:

<DataSource ID="distributorDS" serverType="sql" tableName="dtor">
        <fields>
                <field name="id" type="sequence" hidden="true" primaryKey="true" />
                <field name="name" title="Description" type="ntext" required="true"/>
                <field name="status" title="Status" type="boolean" />
        </fields>
</DataSource>

Code:

<DataSource ID="productDS" serverType="sql" tableName="pdu">

        <fields>
                <field name="id" type="sequence" hidden="true" primaryKey="true" />
                <field name="name" title="Product Name" type="ntext" length="128" required="true"/>
                <field name="code" title="Code" type="integer" required="true"/>     
                <field name="dfid" title="Dosage Form" type="integer" foreignKey="dosformDS.id" joinType="outer" displayField = "dosageformName" required="true">
                </field>
                <field name="dosageformName" includeFrom="dosformDS.name" hidden="true" />
               
                <field name="pgr" title="Product Group" type="integer" foreignKey="productGroupDS.id" joinType="outer" displayField="productGroup" required="true"/>
                <field name="productGroup" includeFrom="productGroupDS.name" hidden="true" />
               
                <field name="ro" title="Route Of Administration" type="integer" foreignKey="routeOfAdminDS.id" joinType="outer" displayField="roa" required="true"/>
                <field name="roa" includeFrom="routeOfAdminDS.name" hidden="true" />
               
                <field name="pu" title="Package Unit" type="text" length="5" required="true">
                <valueMap>
                <value>Kg</value>
                <value>Liter</value>
                <value>Pcs</value>
                <value>Other</value>
            </valueMap>
        </field>


Attached Images
File Type: gif sgwt3.gif (6.2 KB)

Viewing all articles
Browse latest Browse all 4756

Trending Articles