Hi Team,
I am loading data on igGrid from a remote URL. I have used "urlParamsEncoded" property of ig DataSource because I need to send "top" and "skip" values to the remote URL. The issue is that whenever igGrid is loading (initial loading on page load or subsequent data binding on click of button, "urlParamsEncoded" method is called twice, once with the value of "top" and "skip", and once more without those values under "pagingParams".
This behavior is causing my remote URL to be invoked twice. Both these threads calling my remote URL seems to be asynchronous. So sometimes, the later thread has got null "top" and "skip" values, and sometimes, the later thread has got valid values for them. Hence, the data that is eventually bound to the grid is not consistent due to variation in "top" and "skip" values being supplied.
Please find below the link to the JSFiddle reproducing this issue. Here, whether it is first time grid load, or on the subsequent button click, the alert box comes twice - once with "top" and "skip" values, and once without them under paging params.
https://jsfiddle.net/hx82Lanf/
Please let me know how to fix this issue, so that only one call is made to the remote URL, and that too that single call should have values for "top" and "skip", not without those values.
Hello,
After investigating this further, I have determined that a request is made twice to the remote URL because ‘dataBind’ method is called after the initialization of the dataSource.
If dataBind is not called, the urlParamsEncoded is emitted only once and with the correct parameters:
function bindData() {
var url = "">mocki.io/.../f7970ac8-9f6e-4a87-b260-c2f2ed352e8c";
return new $.ig.DataSource({
type: "remoteUrl",
dataSource: url,
. . .
urlParamsEncoded: urlParamsEncoded
});
}
I have modified the shared sample, in order to demonstrate the described behavior. Please test it on your side and let me know if you need any further information regarding this matter.
Regards, Monika Kirkova, Infragistics
I see. That really helps. The issue is fixed now. I want to know then what is the point of dataBind() method, if the data gets bound by just initializing igDataSource?