Can someone please provide me with a sample demonstrating how to bind to a WebDataGrid client side NOT using a datasource like in the samples browser? I would like to make a web service call using JSON and bind the data client side, but the only example I can find is the one in the samples browser connecting to a database.
Hello bpg730,
If you use 10.3 version of the toolset there are sample showing this. But keep in mind that this feature is still CTP:
Client side binding
Hope this helps
I have been looking at this example, but it appears as though it is calling methods not available in 10.3. Specifically, I am getting an error on the grid._applyClientBinding() line. Is there an updated version or hotfix that has these methods for the WebDataGrid?
$(grid._elements.dataTbl.lastChild).empty(); // call that before you load the new data
in fact you don't need to call tmpl() or render for every record, it should work fine if you pass the whole array, too:
$(grid.tableTemplate).render(newData).appendTo(grid._elements.dataTbl.lastChild);
Hope it helps,
Angel
I'm not sure if you are supposed to call the line to clear the previous data at a specific point before the data is loaded, but it does not work when called before the ajax call. It visually clears the data from the table, but when the new data is bound, it is appended to the old data.
I can't get the line above that is supposed to let you pass the whole data element in to work at all. It just makes the grid blank.
Regarding your first question you neeed to set Width, DefaultColumnWidth and Height of the WebDataGrid in order to force scrollbars to show when is needed.
Regarding the second one you need to call _dataBind() in order to get the proper rows count.
But at this time this method is not working as expected because the functionality is still CTP.
Let us know if you need further assistance regarding this.
Everything should be working fine in the CTP, this is not related to that. I suppose this could be related to something else specific to the javascript code / project. Also please note that the correct API call is called _applyClientBindings(), not _dataBind(). Even though _dataBind() exists, it should not be called as the logic there it is not based on jQuery but MS AJAX. We will of course refactor this cleanly for the RTM release.
After calling _applyClientBindings(), grid._get_rows() still contains no rows.
Also, I am still having trouble clearing the old rows before re-binding data to the grid. When I try to rebind a second chunk of data to the grid, it is just appending it to the bottom of the previous data.
I created a new support ticket on your behalf.
CAS-55857-5X0RX8
You can update the case it with your isolated sample.
Hope hearing from you.
please do not use _get_rows() for now. You should probably have got the JSON on the client-side, so you can check how many rows are there by doing jsonData.length.
Our online sample about client binding does clear the rows after every rebinding which happens within a specific time interval, so i am not sure what could be wrong in your case. You can follow up with dev support or attach a sample project to me and i'll resolve the issue
Thank you