Hi there,
I have a big paged tree (in the example with 1200 nodes). The advantages of a paged tree is, that the data is loaded when needed.
A ListGrid with a DataSource does also quite a good job while loading only the data from the server, which are needed. For example while dragging the scrollbar to the bottom of a ListGrid with a Datasource. When first seeing the Listgrid the first x shown records are fetched (for example 1-37). When scrolling to the bottom the last records are fetched (for example 137-160). The data between these two groups are loaded when needed.
This behaviour should also be in the paged treegrid, but it isn't. (Tested in the latest release of 10.1 SmartClient_v101p_2016-05-14_Pro).
Here you can see I have a large treegrid, and drag the scrollbar to the bottom. I would assume the second request would only load the nodes between 1150-1200, but instead it load all nodes after the last node of the first request. Therefore the load is slower than working with listgrids(like described above load only the last x records), because it has to load a larger subset of the total nodes.
Even if I press F5 the TreeGrid is build new and the data is loaded. It seems the TreeGrid is automatically scolling to the bottom, and also loads the complete tree with 2 requests. I can understand why there have to be 2 requests (to get the totalNum of nodes), but the second requests (same problem as above) shouldn't need to load all nodes after 50 to 1200:
In addition: Is there a possibility to turn off this automatic scrolling after a page-refresh?
This is the code for reproduction:
Best Regards
I have a big paged tree (in the example with 1200 nodes). The advantages of a paged tree is, that the data is loaded when needed.
A ListGrid with a DataSource does also quite a good job while loading only the data from the server, which are needed. For example while dragging the scrollbar to the bottom of a ListGrid with a Datasource. When first seeing the Listgrid the first x shown records are fetched (for example 1-37). When scrolling to the bottom the last records are fetched (for example 137-160). The data between these two groups are loaded when needed.
This behaviour should also be in the paged treegrid, but it isn't. (Tested in the latest release of 10.1 SmartClient_v101p_2016-05-14_Pro).
Here you can see I have a large treegrid, and drag the scrollbar to the bottom. I would assume the second request would only load the nodes between 1150-1200, but instead it load all nodes after the last node of the first request. Therefore the load is slower than working with listgrids(like described above load only the last x records), because it has to load a larger subset of the total nodes.
Even if I press F5 the TreeGrid is build new and the data is loaded. It seems the TreeGrid is automatically scolling to the bottom, and also loads the complete tree with 2 requests. I can understand why there have to be 2 requests (to get the totalNum of nodes), but the second requests (same problem as above) shouldn't need to load all nodes after 50 to 1200:
In addition: Is there a possibility to turn off this automatic scrolling after a page-refresh?
This is the code for reproduction:
Code:
isc.VLayout.create({
"ID" : "rootLayout_5",
"width" : "100%",
"height" : "100%",
"autoDraw" : true,
"hideUsingDisplayNone" : false,
"leaveScrollbarGap" : false,
"members" :
[
isc.Button.create({
title: "take the scroller an drag it to the bottom",
width: 200,
click:function(){
}}
),
isc.TreeGrid.create({
"ID" : "theTreeGrid",
"width" : "100%",
"height" : "300",
"selectionType" : "multiple",
"canEdit" : false,
"showFilterEditor" : false,
dataSource : isc.DataSource.create({
"fields" :
[{
"name" : "treeGridGeneratedIndex",
"primaryKey" : true,
"hidden" : true,
"canView" : false
}, {
"name" : "nameField",
"title" : "Reason",
"type" : "text"
}, {
"name" : "parentId",
"rootValue" : "root",
"foreignKey" : "treeGridGeneratedIndex",
"hidden" : true
}
],
"dataFormat" : "json",
"dataURL" : "http://www.devset.de/treegrid4.php",
"transformRequest" : requestTransformer,
"transformResponse" : responseTransformer,
"recordXPath" : "\/resultData",
useHttpProxy : false
}),
dataProperties : {
openProperty : "isOpen",
childrenProperty : "children",
canReturnOpenFolders: true,
progressiveLoading : false
},
"autoFetchData" : true,
"dataPageSize" : 50,
"dataFetchMode" : "paged",
"selectionProperty" : "isSelected",
"fields" :
[{
"name" : "nameField",
"title" : "Reason",
"type" : "text",
"canEdit" : true,
"canSort" : true
}, {
"name" : "lastField",
"title" : "Name",
"type" : "text",
"canEdit" : true,
"canSort" : true
}, {
"name" : "randomField",
"title" : "random",
"type" : "text",
"canEdit" : true,
"canSort" : true
}
],
"selectionProperty" : "isSelected",
"members" :
[]
})
]
});
function requestTransformer(dataSourceRequest) {
var operationType = {
operationType : dataSourceRequest.operationType
};
if (dataSourceRequest.operationType == "fetch") {
var params = {
delay: 300,
sortBy : dataSourceRequest.sortBy,
start : dataSourceRequest.startRow,
end : dataSourceRequest.endRow
};
}
return isc.addProperties({}, operationType, dataSourceRequest.data, params);
}
function responseTransformer(dataSourceResponse, dataSourceRequest, jsonData) {
if (dataSourceRequest.operationType == "fetch") {
dataSourceResponse.totalRows = jsonData.totalRows;
dataSourceResponse.endRow = jsonData.endRow;
dataSourceResponse.startRow = jsonData.startRow;
};
}
Comment