Announcement

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

    problem with update of ListGrid (RestDataSource )

    Hello everybody,

    i am facing a problem that i am not able to handle.

    i use RestDataSource to load data into a ListGrid. For test, i let the server of fetchdata give every time the same response back.

    if i use ListGrid.setAutoFetchData(true), addData(record), updateData(new ListGridRecord(...)) and removeData(record) work well.

    i want do the same thing, but this time manuell to fetch data.(data is the same data in first case)

    but if i use fetchData(form.getValuesAsCriteria()) to load the same data from server, the ListGrid will be firstly updated, after this, if i use addData(record), updateData(new serviceRecord(...)) and removeData(record), i can get the right response from my server, but the grid are not updated.

    Does anyone have an idea about how to handle this?
    Best Regards and thanks in advance
    Last edited by RWTH; 12 Mar 2009, 15:20.

    #2
    has someone an idea?

    Comment


      #3
      Why are you calling fetchData() directly to populate the grid - what's the purpose?

      Comment


        #4
        the senario i wrote in "problem with update of ListGrid (RestDataSource )" is only the problem by testing.

        i want to do something like this:

        firstly, i have a empty ListGrid.

        secondly, i want to add a record into my database,and this record will be showed in this ListGrid.

        but if i call direct ListGrid.addData(record), i get the right response from server, but the ListGrid shows nothing.

        please tell me, did i something wrong? or i can only add record on the ListGrid if the ListGrid is not empty?

        thanks for your help.
        Last edited by RWTH; 12 Mar 2009, 15:42.

        Comment


          #5
          Didn't really follow that. As a general tip, use the ResultSet log category in the Developer Console to troubleshoot any problems you may be having with changes not propagating between components.

          Comment


            #6
            I have the same issue with an empty TreeGrid. The developer console has ResultTree log output as follows:

            16:50:00.887:XRP6:INFO:ResultTree:isc_ResultTree_186 (created by: isc_OID_115):Updating cache: operationType 'add', 1 rows update data:
            [
            {orderId: "1_0",
            allocQuantity: 0,
            productPrice: 168.5,
            seq: 0,
            parent: undef,
            productName: "iphone",
            orderQuantity: 1,
            totalPrice: 168.5,
            itemKey: "agtzbWFydHJldGFpbHIPCxIJT3JkZXJJdGVtGDYM",
            productId: 2}
            ]


            Well, after the addData operation, the grid is still empty.

            Then, I tried the sample RestDataSource (http://www.smartclient.com/smartgwt/...red_restfulds). The developer console has ResultSet log output as follows:

            17:05:07.050:XRP8:DEBUG:ResultSet:isc_ResultSet_90 (created by: isc_OID_72):dataSource data changed firing
            17:05:07.051:XRP8:INFO:ResultSet:isc_ResultSet_90 (created by: isc_OID_72):updating cache in place after operationType: add, allMatchingRowsCached true
            17:05:07.051:XRP8:INFO:ResultSet:isc_ResultSet_90 (created by: isc_OID_72):Updating cache: operationType 'add' (no compnentID) ,1 rows update data:
            [
            {countryCode: "A1",
            countryName: "Saved Value",
            capital: "Saved Value",
            continent: "Saved Value"}
            ]
            17:05:07.051:XRP8:INFO:ResultSet:isc_ResultSet_90 (created by: isc_OID_72):sortByProperty(countryCode, true): full cache allows local sort
            17:05:07.052:XRP8:INFO:ResultSet:isc_ResultSet_90 (created by: isc_OID_72):Local filter applied: 8 of 8 records matched filter:{}
            17:05:07.052:XRP8:INFO:ResultSet:isc_ResultSet_90 (created by: isc_OID_72):sortByProperty(countryCode, true): full cache allows local sort
            17:05:07.106:RDQ1:DEBUG:ResultSet:isc_ResultSet_90 (created by: isc_OID_72):getRange(0, 7) satisfied from cache


            It seems my part failed to update cache. My treegrid setup is almost the same as the listgrid in sample. I can't figure out the solution. Please give me some suggestion:)

            Thanks
            Last edited by daodao; 28 Mar 2009, 03:57.

            Comment


              #7
              Hello, any suggestion?

              I turned on the RPCManager and RPCResponse in Developer Console Log. And here's the more detailed log after addData on TreeGrid (here "seq" is the primary key of record)

              00:11:29.703:MUP6:INFO:RPCManager:sendQueue[11]: 1 RPCRequest(s); transport: xmlHttpRequest; target: data/orderItems_add
              00:11:29.704:MUP6:DEBUG:RPCManager:XMLHttpRequest POST to data/orderItems_add contentType: application/x-www-form-urlencoded; charset=UTF-8 with body -->__ref={}&seq=1&itemKey=Key&parent=Key&productId=1&orderId=1_0&productName=巧克力蛋糕-C-6寸&productPrice=0&orderQuantity=1&allocQuantity=0&allocStatus=&discountId=1&discountName=normal&totalPrice=0&_operationType=add&_dataSource=OrderItems<--
              00:11:29.734:XRP9:INFO:RPCManager:transaction 11 arrived after 31ms
              00:11:29.734:XRP9:DEBUG:RPCManager:Result string for transaction 11: "{
              "response": {
              "status": 0,
              "data": [
              {
              "orderId": "1_0",
              "allocQuantity": 0,
              "productPrice": 168.0,
              "seq": 1,
              "parent": null,
              "discountId": 1,
              "allocStatus": "\u672a\u5206\u914d",
              "productName": "\u5de7\u514b\u529b\u86cb\u7cd5",
              "orderQuantity": 1,
              "totalPrice": 168.0,
              "itemKey": "agtzbWFydHJldGFpbHIPCxIJT3JkZXJJdGVtGDYM",
              "discountName": "\u666e\u901a\u9500\u552e",
              "productId": 2
              }
              ]
              }
              }"
              00:11:29.735:XRP9:INFO:RPCManager:rpcResponse(unstructured) results -->"{
              "response": {
              "status": 0,
              "data": [
              {
              "orderId": "1_0",
              "allocQuantity": 0,
              "productPrice": 168.0,
              "seq": 1,
              "parent": null,
              "discountId": 1,
              "allocStatus": "\u672a\u5206\u914d",
              "productName": "\u5de7\u514b\u529b\u86cb\u7cd5",
              "orderQuantity": 1,
              "totalPrice": 168.0,
              "itemKey": "agtzbWFydHJldGFpbHIPCxIJT3JkZXJJdGVtGDYM",
              "discountName": "\u666e\u901a\u9500\u552e",
              "productId": 2
              }
              ]
              }
              }"<--
              00:11:29.739:XRP9:INFO:ResultTree:isc_ResultTree_182 (created by: isc_OID_112):Updating cache: operationType 'add', 1 rows update data:
              [
              {orderId: "1_0",
              allocQuantity: 0,
              productPrice: 168,
              seq: 1,
              parent: undef,
              discountId: 1,
              allocStatus: "未分配",
              productName: "巧克力蛋糕",
              orderQuantity: 1,
              totalPrice: 168,
              itemKey: "agtzbWFydHJldGFpbHIPCxIJT3JkZXJJdGVtGDYM",
              discountName: "普通销售",
              productId: 2}
              ]


              It seems the request, response and resultTree update are all ok. But my Treegrid failed to show the new added record. I'm using SmartGWT 1.0b2 and DataSource format is JSON. please help me:)
              Last edited by daodao; 29 Mar 2009, 08:27.

              Comment


                #8
                Oh, finally I find the mistake I made in my addData request.

                I set the parent field to "Key" in the addData request. The response has the record with parent field set to null, which lead to the TreeGrid failed to update the cache.

                Sorry for the confusion. Now my treegrid works properly

                Comment

                Working...
                X