Announcement

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

    Multiple requests with dataFetchMode paged and ReturnOpenFolders in TreeGrid

    Hi,
    I try to use a treeGrid with a dataSource and the "dataFetchMode: paged" attribute.
    It works like charm, but if I set the “dataPropterties” to open the nodes when they were loaded the treeGrid does not work correctly.

    The code for the treeGrid is the following:
    Code:
          isc.TreeGrid.create(
           {
            "ID":"absencesTreeGrid",
            "width":"100%",
            "height":"100%",
            "selectionType":"single",
            "canEdit":false,
            dataSource:isc.DataSource.create(
             {
              "fields":
              [
               {
                "name":"parentId",
                "hidden":true,
                "canEdit":false,
                "canSort":false,
                "rootValue":"0",
                "foreignKey":"id",
               }
              ],
              "dataFormat":"json",
              "dataURL":"ScTreeGridDataSource?viewNumber=13&id=absencesTreeGrid",
              "transformRequest":clwTransformRequest,
              "transformResponse":clwTransformResponse,
              "recordXPath":"\/resultData"
             }
             ),
            "autoFetchData":true,
            "dataPageSize":100,
            "dataFetchMode":"paged",
            "selectionProperty":"isSelected",
            "fields":
            [
             {
              "name":"statusListGridField",
              "title":"Status",
              "type":"text",
              "width":220,
              "canEdit":false,
              "canSort":false,
             },
             {
              "name":"absenceKindGridField",
              "title":"Absence type",
              "type":"text",
              "align":"left",
              "canEdit":false,
              "canSort":false,
             },
            ],
            "dataProperties":
            {
             "canReturnOpenFolders":true,
             "childrenProperty":"children",
             "openProperty":"isOpen"
            }
           }
           ),
    The first thing I noticed is, that there are too many requests. The first, for the root, seems correct and looks like this:
    Code:
    end	        100
    id		absencesTreeGrid
    operationType	fetch
    parentId	0
    start		0
    The other requests are ignoring the “dataPageSize” I have set at the initalization of the treeGrid.
    The request for the first child looks like this:
    Code:
    end		2
    id		absencesTreeGrid
    operationType	fetch
    parentId	24
    start		0
    If there are more objects under the node a second request is triggerd to get the next page of the visible nodes
    Code:
    end		102
    id		absencesTreeGrid
    operationType	fetch
    parentId	24
    start		2
    This additional request use the correct dataPageSize (100).

    The request for the second child looks like this:
    Code:
    end		1
    id		absencesTreeGrid
    operationType	fetch
    parentId	25
    start		0
    And so on.

    Note I have three nodes under the root-node and it seems that the start to end number in the request is bound to the number of these nodes. Also the end number decreases from request to request. So the first requests starts with start: 0 end: 3, the second request with start: 0 end: 2 and the last request calls with: start: 0 end: 1. Because there are many more items, for each of the three nodes there an additional request for the rest of the nodes is started.

    At this point I stepped into another problem. If I use the dataPropterties option to open the nodes
    something is going wrong with the visual selection of the elements

    To explain that problem I attached the given file:


    The selection type is set to “single”, so only one line should be selected.
    But if you see it is possible to select more than one object. This is only a “visual” bug, the update method of the tree grid fires correctly and returns the correct object. It looks like the previous selected row doesn’t get redrawed after selecting a new row. After hovering the previous selected row the visual selection is removed.

    I think there is a correlation between the selection and the request problem.

    So do you have any suggestion what I can do to solve these problems, or is that a bug?

    I have tested this behavior in all current browsers (IE 11, Firefox 34, Chrome 39) with the latest nightly build (SmartClient_v100p_2014-12-17_Pro)

    Best Regards

    #2
    See the Tree Data Binding overview - we explicitly cover that loaded nodes cannot be returned already opened when using dataFetchMode:"paged", and provide a special property and special rules for handling this in limited cases.

    Comment


      #3
      Hi,

      I have read the Data Binding Overview again and inspected the examples.
      I found the childCount attribute and set it for the three nodes under the root node. Having done that the problem with the multiple requests is gone
      and there is only one request for one request per open node. Unfortunately the problem with the wrong selected rows still persists.

      I think I have set all required attributes:
      autoFetchData
      dataPageSize
      dataFetchMode
      canReturnOpenFolders
      childrenProperty
      openProperty
      childCount

      So do you have any suggestion what I can do to solve this problem?
      Is there another missing attribute?

      Best Regards

      Comment


        #4
        Glad you fixed the data binding issue. As far as the selection issue, we don't have enough information to try to reproduce it, but:

        1. there may be a JS error or usage warning - check the Developer Console (always do this)

        2. you should carefully look at your returned responses from the server to see if you ever set an invalid (eg non-numeric) startRow, endRow or totalRows value, or just omit it entirely

        Comment

        Working...
        X