Announcement

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

    TreeGrid with different sql tables

    Hi,

    I am evaluating smartClient using a snapshot 8.0 release. I would like to setup a treegrid which with different datasources (sql tables). The parent is a dataSource and the 1. child is another datasource, the second child is a dataSource and so on.

    Example:

    - parent_1
    | |
    | --- 1.Child
    | |
    | ----- 1.Child
    | |
    | --- 2.Child
    |
    - parent_2
    | |
    | --- 1.Child
    | |
    | ----- 1.Child
    | |
    | --- 2.Child
    |
    parent_3

    In the feature explorer their is no example which explains such an approche, how is it possible to such an integration. I have been looking around in this forum the only thing I found is a post about the fact that the user has to use DMI. Is there not a more easier way ot integrate multiple dataSources.

    Thanks,

    Jeronimo

    #2
    Two approaches: there's a built-in feature for doing this, already mostly developed, where the client-side tree object sends requests to multiple DataSources automatically. You could sponsor this.

    Otherwise, either client or server, you can create a single DataSource that queries other DataSources based on the parent node's type.

    Comment


      #3
      Hi,

      Where can I find a documentation regarding that built in feature, and if I manage to get it working I can sponsor it.

      Thanks,

      Jeronimo

      Comment


        #4
        If a feature needs sponsoring that means its incomplete - no documentation or samples exist.

        But to give an idea, you simply bind a TreeGrid to a DataSource as normal and set a property "multiDSTree" (meaning multiple DataSource Tree). Then related DataSources will be discovered by foreignKey declarations, or you can provide an explicit order of traversal (eg dataSources: ["supplyCategory", "supplyItem"] to traverse from categories to items).

        Comment


          #5
          Hi,

          Thanks for the tip it is just working the way I want. I will try to do some work around the multiDSTree.

          Jazevedo

          Comment


            #6
            I'm working on an almost identical problem to the one described here: A top level webservice/datasource providing the parent nodes and another providing data for the children, based on the value of the parent.

            Specifically I have (top-level) subnets that contain devices. I'd like to query the subnet webservice for the top-level subnets and then when a subnet is expanded query the service with the subnet ID to return the devices in that subnet.

            I'm only using the client-side SmartClient, and a recent v8.x nightly.

            I've not yet been able to get it working based on the tantalisingly brief discussion in this thread so a brief example of the multiDSTree working would be a great help.

            I can see a way of doing this via an overridden transformRequest() but that seems overkill if the feature is already (almost) there.

            Thanks in advance.

            Comment


              #7
              Hi,

              In my exmaple I use the provided smarclient server, we are using the power edition of smarclient. We created the our dataSources using the 'DataSource Generator' and using the foreign key relation between two tables smarclient server queries the child entries when we click on the parent leave.

              Here an example:

              The top level leafs (Parent Node) dataSource
              Code:
              <DataSource 
              	schema="public"
              	dbName="node_network"
              	tableName="central"
              	ID="central"
              	dataSourceVersion="1"
                      serverType="sql"
                      titleField="ct"
              >
              	<fields>
              		<field primaryKey="true" name="id" title="Name" type="sequence" required="true" sequenceName="hibernate_sequence"/>
              	</fields>
              
              </DataSource>
              Here the Child Node dataSource of the Parent Node

              Code:
              <DataSource
                      schema="public"
              	dbName="node_network"
              	tableName="ctswitch"
              	ID="ctswitch"
              	dataSourceVersion="1"
                      serverType="sql"
                      titleField="ctSwitch"
              >
              	<fields>
              		<field primaryKey="true" name="id" hidden="true" type="sequence" sequenceName="hibernate_sequence"/>
              		<field name="ctSwitch" length="10" type="text"/>
              		<field name="fk_central" type="integer" required="true" foreignKey="central.id" />
              	</fields>
              
              </DataSource>
              Here the jsp code

              Code:
              isc.TreeGrid.create ({
                  ID: "centralTree",
                  dataSource: "central",
                  multiDSTree: "true",
                  autoFetchData: "true",
                  showHeaderMenuButton: false,
                  treeFieldTitle: "Node Network"
              })
              I treid also transformRequest(), but it ends with a lot of work. You should also have a look at DMI.

              Hope this helps,

              Jero

              Comment

              Working...
              X