I use a tabular control which support async tab where igGrid is placed. Is there any sample I can take a look how to use ig.loader to set up igGrid on async control?
Hello Michael,
I have been looking into you requirements and I assume that you are placing our igGird in WebTab or similar control. You could place our igGrid inside such controls by just adding the containing
$.ig.loader(function () {
$("#grid").igGrid({
columns: [
{ headerText: "Product ID", key: "ProductID", dataType: "number" },
{ headerText: "Product Name", key: "Name", dataType: "string" },
{ headerText: "Product Number", key: "ProductNumber", dataType: "string" }
],
width: "500px",
height:"500px",
dataSource: products
});
Depending on your scenario it may be more suitable to add the definition of this control inside event as SelectedIndexChanged of the WebTab in order to make sure that the user has already moved to the specified tab.
For further reference you can check the attached sample.
If you need any additional assistance on this matter please do not hesitate to ask.
Hi Elena,
Thanks for the sample, it works perfectly even after enable load on demand on webtab by adding property
<PostBackOptions EnableLoadOnDemand ="True"></PostBackOptions>
I put breakpoint at $.ig.loader, and noticed that it was called twice:
- First time when page is loaded (grid element was not there yet, so nothing happened)
- Second time when tab2 was selected (it executed after “changed” function was called), the grid is loaded correctly.
I’m very curious on how ig.loader been bind to webtab event itself, what mechanism is behind? I don't see any code in your sample. The reason I’m asking is that ig loader doesn’t behavior the same when using UltraWebTab (from Infragisitcs as well) when AsyncMode is turned on (AsyncMode="On"). ig loader is only called first time when page is load, no second time when tab was selected.
Any suggestion on how to make igGrid work on UltraWebTab AsyncMode will be really appreciated.
Michael
Thank you for the update . I believe that the issue that you mentioned may be caused if the second tabs content is regenerated when you select the second tab. Therefore in this scenario you can just handle the AfterSelectedTabChange event of the UltraWebTab and initialize the igGrid in this handler.
in markup:
<igtbl:UltraWebTab runat="server" ID="UltraWebTab2" AsyncMode="On" >
<ClientSideEvents AfterSelectedTabChange="afterSelectEvent" ></ClientSideEvents>
in js:
function afterSelectEvent(owner, tabItem, evnt) { $.ig.loader(function () { alert("bind"); $("#grid").igGrid({ columns: [ { headerText: "Product ID", key: "ProductID", dataType: "number" }, { headerText: "Product Name", key: "Name", dataType: "string" }, { headerText: "Product Number", key: "ProductNumber", dataType: "string" } ], width: "500px", height: "500px", dataSource: products }); }); }
If you need any additional assistance on this please let me know.