Announcement

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

    Update Data in Client Only

    I have created a TreeGrid which uses a client dataSource in order to get support for updateData().

    However I am unable to get it to update the records or even add new records via the datasource.

    Does not work:
    Code:
    DataSource.addData({id:511,title:'horse'})
    However I can use the following by accessing the data directly:
    Code:
    TreeGrid.data.add({title: 'dfds', id: 1, parentId: 'root'},TreeGrid.data.getRoot())
    This method would be good but there is no TreeGrid.data.update() feature.

    Is it possible to update records in a treeGrid via updataData where no requests are made to the server, if so how?

    If it is not possible is there an alternative method of manipulating the TreeGrid.data directly in order to change values, again how?

    I have looked at:
    Code:
    countryData[0]['countryName']='new name';
    This changes the value in the array but not the value displayed, is there a refresh data function?

    All I am after doing it updating the icons next to nodes is there an alternative I have overlooked?

    Thanks
    Last edited by nickc; 15 Jan 2009, 03:08.

    #2
    addData() will work, but in order for the new node to appear in the tree, it's going to need to have the id of it's parent node, right?

    If you change the data directly, call redraw() (or refreshRow() or refreshCell() for finer granularity).

    Comment


      #3
      Thank you, I was missing the redraw.

      Comment


        #4
        How do I remove all data from the TreeGrid?

        I am using this method to add it:
        Code:
        TreeGrid.data.add
        I tried this but am getting an error:
        Code:
        TreeGrid.data.removeAll()
        TypeError: _1 is undefined source=TreeGrid.data.removeAll()

        Normally when working with a datasource I set the data array to null but that doesn't work here.

        Comment


          #5
          Set it to a new (empty) Tree.

          Comment

          Working...
          X