Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

Multiple requests with dataFetchMode paged and ReturnOpenFolders in TreeGrid

$
0
0
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

Viewing all articles
Browse latest Browse all 4756

Trending Articles