Announcement

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

    TreeGrid reparent - automatically call executeUpdate on server

    Is it possible to disable the call, and remember the reparents on client side. The update will be called only if I click a submit button. I tried treeGrid.setAutoSaveEdits(false). That doesn't help.

    #2
    massupdate treegrid doesnt work with autoSaveEdits(false)

    i have the same issue. after reparent the treegrid contacts the server with update operations despite
    autoSaveEdits is false.

    want to have all at client side and do a massupdate after button is clicked works in listgrid but not in treegrid for me.

    did you or someone else found/has a solution?

    edit:
    Be sure your post includes:

    1. SmartClient Version: v8.1p_2012-06-12/LGPL Development Only (built 2012-06-12)

    2. firefox 14.0.1

    3. this update operation is send to the server when reparenting: {
    "dataSource":"isc_RestDataSource_0",
    "operationType":"update",
    "data":"{\r \"dataSource\":\"isc_RestDataSource_0\", \r \"operationType\":\"update\", \r \"data\":{\r \"id\":\"d\", \r \"ReportsTo\":\"c\", \r \"isFolder\":false, \r \"isOpen\":\"false\"\r }, \r \"oldValues\":{\r \"id\":\"d\", \r \"ReportsTo\":\"root\", \r \"isFolder\":false, \r \"isOpen\":\"false\"\r }\r}",
    "parentNode":{
    "id":"root",
    "children":[
    {
    "id":"d",
    "ReportsTo":"root",
    "isFolder":false,
    "isOpen":"false"
    },
    {
    "id":"a",
    "ReportsTo":"root",
    "isFolder":true,
    "isOpen":"true",
    "children":[
    {
    "id":"b",
    "ReportsTo":"a",
    "isFolder":false,
    "isOpen":"false"
    }
    ]
    },
    {
    "id":"c",
    "ReportsTo":"root",
    "isFolder":true,
    "isOpen":"false",
    "children":[
    ]
    }
    ],
    "isFolder":true
    },
    "showPrompt":true,
    "oldValues":{
    "id":"d",
    "ReportsTo":"root",
    "isFolder":false,
    "isOpen":"false"
    },
    "requestId":"isc_RestDataSource_0$62712"
    }

    6. my treegrid:

    public class FavoritesGrid extends TreeGrid {

    public FavoritesGrid() {
    setWidth("12%");
    setShowConnectors(false);
    setShowResizeBar(true);
    setCanReorderRecords(true);
    setCanAcceptDroppedRecords(true);
    setCanDragRecordsOut(true);
    setCanReparentNodes(true);
    setDragDataAction(DragDataAction.MOVE);
    setAutoSaveEdits(false);
    setAutoFetchData(false);

    setLoadDataOnDemand(false);
    setHeight("50%");

    RestDataSource ds = new RestDataSource();
    ds.setRecordXPath("/");
    ds.setDataFormat(DSDataFormat.JSON);

    OperationBinding fetch = new OperationBinding();
    fetch.setOperationType(DSOperationType.FETCH);
    fetch.setDataProtocol(DSProtocol.POSTMESSAGE);
    fetch.setDataFormat(DSDataFormat.JSON);

    OperationBinding add = new OperationBinding();
    add.setOperationType(DSOperationType.ADD);
    add.setDataProtocol(DSProtocol.POSTMESSAGE);
    add.setDataFormat(DSDataFormat.JSON);

    OperationBinding update = new OperationBinding();
    update.setOperationType(DSOperationType.UPDATE);
    update.setDataProtocol(DSProtocol.POSTMESSAGE);
    update.setDataFormat(DSDataFormat.JSON);

    ds.setOperationBindings(fetch, update, add);

    ds.setDataURL("/XY/Favorites");

    DataSourceTextField key = new DataSourceTextField("id", "id");
    key.setPrimaryKey(true);
    key.setRequired(true);
    DataSourceTextField parent = new DataSourceTextField("ReportsTo",
    "ReportsTo");
    parent.setRequired(true);
    parent.setForeignKey("id");
    parent.setRootValue("root");

    ds.setFields(key, parent);

    setDataSource(ds);

    fetchData();
    }
    }
    Last edited by richard k; 5 Sep 2012, 21:56.

    Comment


      #3
      The same issue: reparent and reorder does not observe autoSaveEdits and triggers update event.
      Isomorphic, is it going to be supported?
      Can you suggest a workaround?
      MichalG

      Comment


        #4
        Isomorphic I am also trying to avoid sending an automatic update to the server when reparenting. How to achieve this ?

        Comment


          #5
          The ResultTree / TreeGrid does not currently have the capability to track a series of reparents and display such unsaved changes. An automatic capability of this kind is non-trivial, when you consider load-on-demand and lots of edge cases like partial failure when committing a series of reparenting changes.

          If you wanted to implement this in an application, you could:
          1. cancel() the automatic data transfer action from drag and drop
          2. store the intended reparenting changes in some format of your own devising, for later saving
          3. use DataSource.updateCaches() to tell the TreeGrid/ResultTree to show the reparenting changes locally
          4. optionally come up with some way of visualizing reparenting changes that have not actually been saved
          5. submit your stored reparenting changes (from step 2) in a queue with other changes, by using startQueuing() then calling saveAllEdits() on the TreeGrid, then sendQueue(). Your reparenting changes could be submitted either before or after other normal changes tracked by the TreeGrid.

          Comment

          Working...
          X