I have further tested the RestDataSource and ListGrid :
With the ListGrid height 400, 19 records are allowed to be shown.
At first loading of the ListGrid, it actually call to the server twice continuously:
1. first time is to get records from 0 to 10 - I think because I specify dataPageSize:10
2. second time is to get records from 0 to 19 - I think to fill up the ListGrid with height 400
I don't understand why it need to do the first call to get the records from 0 to 10.
Or maybe if it is unavoidable to get records 0 to 10, then I think it should get records from 11 to 19 on the second time instead of 0 to 19.
Second case is, when I scroll to the bottom of the list, at that time it will call to server to get records 20 to 35 (my total records is 36)
Right after that, if I click on the Search button on the searchForm, then it will call the doFetch() and some how the ListGrid will refresh twice and call to the server twice continuously:
1. first time is to get records from 17 to 36 - Which I don't understand why.
2. second time is to get the records from 0 to 17
After that the ListGrid will show the first 19 records.
I am hoping that it would call to server once only for both cases to get the first 19 records needed to be shown on the ListGrid, at least for better performance without hitting the server two many times.
Is it something wrong with my codes below or it is a normal behavior?
With the ListGrid height 400, 19 records are allowed to be shown.
At first loading of the ListGrid, it actually call to the server twice continuously:
1. first time is to get records from 0 to 10 - I think because I specify dataPageSize:10
2. second time is to get records from 0 to 19 - I think to fill up the ListGrid with height 400
I don't understand why it need to do the first call to get the records from 0 to 10.
Or maybe if it is unavoidable to get records 0 to 10, then I think it should get records from 11 to 19 on the second time instead of 0 to 19.
Second case is, when I scroll to the bottom of the list, at that time it will call to server to get records 20 to 35 (my total records is 36)
Right after that, if I click on the Search button on the searchForm, then it will call the doFetch() and some how the ListGrid will refresh twice and call to the server twice continuously:
1. first time is to get records from 17 to 36 - Which I don't understand why.
2. second time is to get the records from 0 to 17
After that the ListGrid will show the first 19 records.
I am hoping that it would call to server once only for both cases to get the first 19 records needed to be shown on the ListGrid, at least for better performance without hitting the server two many times.
Is it something wrong with my codes below or it is a normal behavior?
Code:
isc.SearchForm.create({
ID:"searchForm",
position:"relative",
width:"40%",
colWidths:["*","*"],
numCols:5,
titleAlign:"left",
fields: [
{name:"searchName", title:"Name"},
{type:"spacer", width:50},
{name:"searchCountryCode", title:"Country" />",
type: "comboBox",
valueField: "code",
displayField: "name",
optionDataSource:"countryList"},
{type:"toolbar", align:"center", width:450, colSpan:5, buttons: [
{title:"Search", click:"form.doFetch()", extraSpace:15},
{title:"Reset", click:"form.reset()", extraSpace:15},
{title:"Add New Record", click:"form.reset()"}
]}
],
doFetch: function()
{
if (typeof myGrid.data.invalidateCache == 'function')
myGrid.data.invalidateCache();
myGrid.fetchData(searchForm.getValuesAsCriteria());
}
});
Code:
isc.RestDataSource.create({
ID:"myList",
dataFormat:"xml",
fetchDataURL:"http://localhost:8080/myprj/myList",
fields:[
{name:"name"},
{name:"address1"},
{name:"address2"},
{name:"address3"},
{name:"postcode"}
]
});
Code:
isc.ListGrid.create({
ID:"myGrid",
position:"relative",
width:"98%",
height:400,
alternateRecordStyles:true,
autoFetchData:true,
dataPageSize:10,
drawAllMaxCells:0,
drawAheadRatio:1,
scrollRedrawDelay:20,
sortFieldNum:0,
dataSource:"myList"
});
Comment