jQuery UI Widgets › Forums › Grid › Grid's 'initialized' event not fired when source is bound to local data
Tagged: event, grid, initialized, localdata
This topic contains 2 replies, has 2 voices, and was last updated by sushengloong 12 years, 3 months ago.
-
Author
-
August 6, 2012 at 4:00 am Grid's 'initialized' event not fired when source is bound to local data #6601
Hi,
I bind a grid’s initialized event to a function which does something. When I bind the same grid to a local JS data, the grid’s ‘initialized’ event doesn’t seem to fire as the function is not executed when the grid has been loaded. However, when I bind the same grid to a remote URL which returns the same JSON data, everything works correctly. May I know whether this is the expected behavior or bug? Thank you!
Thanks,
Sheng LoongAugust 6, 2012 at 8:42 pm Grid's 'initialized' event not fired when source is bound to local data #6641When do you bind to the ‘initialized’ event – before or after calling the jqxGrid constructor? When you bind to events such as ‘initialized’ you should expect the event to be raised when the Grid is initialized and the data is loaded. When you load the jqxGrid from local data the event is raised when the jqxGrid constructor function is called i.e you should bind to the ‘initialized’ event before calling the constructor. The same is valid for the ‘bindingcomplete’ event. The remote data is loaded asynchronous and that’s why the event is raised when you bind to it after calling the jqxGrid constructor.
Example:
$("#jqxgrid").bind('initialized', function () { alert('grid'); }); $("#jqxgrid").jqxGrid( { width: 670, source: source, theme: theme, filterable: true, sortable: true, autoheight: true, columnsresize: true, groupable: true, pageable: true, autoshowfiltericon: true, columns: [ { text: 'First Name', datafield: 'firstname', width: 300 }, { text: 'Last Name', datafield: 'lastname', width: 300 }, { text: 'Product', datafield: 'productname', width: 280 }, { text: 'Order Date', datafield: 'date', width: 100, cellsformat: 'd' }, { text: 'Quantity', datafield: 'quantity', width: 280, cellsalign: 'right' }, { text: 'Unit Price', datafield: 'price', cellsalign: 'right', cellsformat: 'c2' } ] });
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comAugust 7, 2012 at 2:17 am Grid's 'initialized' event not fired when source is bound to local data #6649Hi Peter,
I see. Thank you for your answer.
Thanks
Sheng Loong -
AuthorPosts
You must be logged in to reply to this topic.