Hi,
I was using IgniteUI igGrid in my project. My grid was getting the dataview() by below javascript code. But, now I need to convert my javascript to Typescript. How can I convert below typescript code to Typescript? I am using attached "igniteui.d.ts" which I got from Infragistics samples. When I use same code in Typescript, it is not compiling. I am not getting much help on Typescript with IgniteUI. Please help.
grid.data('igGrid').dataSource.dataView()
igniteui.d.zip
Hello,
are you sure you are referencing the igntieui.d.ts correctly.
Can you send is an isolated example demonstrating the error?
I have attached the sample below.
igGridTS.zip
Thank you for the sample, it helped a lot.
The reason for this is that data("igGrid") is returning IgGridMethods and the dataSource property is not part of those methods.
I would suggest using the option dataSource:
let ds: any = $("#grid").igGrid("option", "dataSource");
return "Count:" + ds.length;
But note that this will return the whole data. If your application scenario has features involved and you need the dataView then the following will be more appropriate:
let ds: any = $("#grid").data('igGrid')["dataSource"];
return "Count:" + ds.dataView().length;
Regards,
Deyan Kamburov,
Infragistics
Deyan,
Thank you very much for your response. That resolved the issue. But, further in my JavaScript, I have below highlighted code. Here, I have combo in column of Grid. I want to get data source of this combo within the grid. How can I convert this code to TypeScript? I have grid similar to the grid sample at - https://www.igniteui.com/grid/basic-editing.
var grid = $('#Grid');
var comboDataSource = grid.data('igGridUpdating').options.columnSettings[0].editorOptions.dataSource);
Thanks,
Alpesh.
Hello Alpesh,
What about using editorForKey API method?
How can I use editorForKey in TypeScript for getting Combo's datasource ?
The following code snippet demonstrates the usage of editorForKey API method:
let combo: any = $("#grid").data('igGridUpdating').editorForKey("combo"); let comboDS = combo.igCombo("option", "dataSource");
Let me know if you need more information.