Announcement

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

    OpenProperty on TreeGrid not binding to backend data source

    Be sure your post includes:

    1. 3.0 Power nightly build.

    I have a TreeGrid view that is bound to a backend SQL database table.

    I set the TreeGrid view's properties, including setOpenProperty("isOpen"):

    Code:
    		_treeProperties = new Tree();
    		_treeProperties.setNameProperty("name");
    		_treeProperties.setIdField("id");
    		_treeProperties.setParentIdField("parentId");
    		_treeProperties.setIsFolderProperty("isFolder");
    		_treeProperties.setOpenProperty("isOpen");
    		_treeProperties.setTitleProperty("title");
    
    		_tree = new TreeGrid();
    		_tree.setDataProperties(_treeProperties);
    My datasource definition file bound to the tree:
    Code:
    <DataSource ID="categoryDevice" serverType="hibernate" titleField="Categories"
      beanClassName="com.bpt.db.model.CategoryDevice" dropExtraFields="true">
      <fields>
        <field name="id" type="sequence" hidden="true" primaryKey="true" />
        <field name="title" type="text" title="Categories" />
        <field name="name" type="text" title="Categories" valueXPath="device/hostName" />
        <field name="deviceId" type="integer" hidden="true" valueXPath="device/id" />
        <field name="userId" type="integer" hidden="true" />
        <field name="parentId" type="text" hidden="true" />
        <field name="isFolder" type="boolean" hidden="true" valueXPath="category"/>
        <field name="isOpen" type="boolean" hidden="true" valueXPath="open" />
        <field name="isLocked" type="boolean" hidden="true" valueXPath="locked" />
      </fields>
    </DataSource>
    However, whenever I load my app or refresh the page or call _tree.fetchData, all the folders show up collapsed/closed.

    For example, here is some sample data in the DB table:
    Code:
    id	category	locked	open	parentId	title	                        type	userId	device_id
    1	1	        1	  1             NULL	        Provider Edge (PE)	0	1	NULL
    2	1	        1	  1             NULL	        Route Reflector (RR)	1	1	NULL
    16	0	        0	  0             1	        NULL	                        2	1	5
    As one can see, tree folder with id #1 is 'open', but when the UI is drawn this folder is shown closed. Also, if folders within the tree view are opened/closed, this state is not saved back to the DB table although the openProperty has been set.

    Can anyone verify this actually works? Am I missing a step? All the other set***Properties seem to bind to the datasource correctly.

    Thanks!
    Last edited by chimpeenuts; 29 Jan 2012, 13:02.

    #2
    Check the RPC tab to see the actual response you are sending. You may actually be sending blank "open" properties or some non-boolean value.

    Comment


      #3
      First, I'm not sending any data back to the server. I assumed that the TreeGrid would send an update back when a folder was opened in the TreeGrid. This assumption may be incorrect, however, since I don't see any updates in the DB when I open/close a folder.

      I'm assuming I would need to do a datasource.update on the record representing the folder?
      Last edited by chimpeenuts; 15 Feb 2012, 18:15.

      Comment


        #4
        We meant show the data actually coming from the server, to check if it has correct values for the openProperty.

        Correct, folder openState is not automatically persisted, if you want to save it, a good time is when you receive the request to load its children.

        Comment

        Working...
        X