Hi
Below is my use case.
1) In initial request, for a given customerId, i need to get the last N number of records (with basic data like RefId, name, time) and display it
2) Now on click of any of the RefId, i have 2 behaviours
a) Display 3 links (with static text) and on click of any of the links, need to get the data using "$.ajax" which will return JSON and display the same.
b) Get the response which contains 3 JSONs and display it directly.
I have very complex JSON's. Could you please do the needful help with proper code and whether can i achieve this using Grid or Hierarchical Grid etc ...
Thanks & Regards
Hello venkat ,
Thank you for posting in our forum.
Depending on what type of data you’re aiming to visualize- flat or hierarchical, you can use the related control- igGrid for flat data and igHierarchicalGrid for hierarchical.
You can refer to the following examples on how the grids can be bound to JSON data on the client:
http://www.igniteui.com/grid/json-binding
http://www.igniteui.com/hierarchical-grid/json-binding
You can also refer to our online documentation for the grids that contain overviews and code examples on how they can be defined on the page:
http://help.infragistics.com/doc/jQuery/2014.1/CLR4.0/?page=igGrid_Overview.html
http://help.infragistics.com/doc/jQuery/2014.1/CLR4.0/?page=igHierarchicalGrid_Overview.html
Depending on what type of data source you’re using, the approach for taking the last N records would be different.
For example if the data source is contained in a Queryable collection you could reverse the collection and take N records from it:
<QueryableCollection>.Reverse().Take(N)
Let me know if you have any questions or concerns regarding binding the grids to a Json object on the client side.
Best Regards,
Maya Kirova
Developer Support Engineer II
Infragistics, Inc.
http://es.infragistics.com/support
Thanks for Your reply.
My Question is: In the first request i am getting N records (with basic data like RefId, name, time) and displaying them using igGrid.
Now, on clicking RefId, i should make one more Ajax request and get the JSON data and display the same. How to make this second call, how do i get the selected RefId and process the next request. Expecting some code with the above simulation.
Thank you.
Hello TopCoder ,
I’m just following up to see if you’ve been able to resolve your issue. If you have any questions or concerns or if you need further assistance please let me know.
Developer Support Engineer
http://www.infragistics.com/support
Hello,
If your aiming to trigger an ajax request when a cell from a specific column is clicked you can use the cellClick event:
http://help.infragistics.com/jQuery/2014.1/ui.iggrid#events:cellClick
In it you can check to which column the cell belongs to (ui.colKey) and get its value (var cellValue=$("#grid").igGrid("getCellValue",ui.rowIndex, ui.colKey); ).
Then if you could make an ajax request and pass any additional parameters you would like, for example you could pass the selected value.
Here’s an example:
$(document).delegate("#grid", "iggridcellclick", function (evt, ui) {
if( ui.colKey=="<YourColumnKey>")
{
var cellValue=$("#grid").igGrid("getCellValue",ui.rowIndex, ui.colKey);
alert(cellValue);
//You can make an ajax get request the server and pass the additional params you want
//For example:
//$.get( "<YourUrl>", { cellValueClicked: cellValue } )
//.done(function( data ) {
//alert( "Data Loaded: " + data );
//});
}
For more details on how the ajax $get method works and what members it accepts you can refer to the JQuery Documentation:
http://api.jquery.com/jquery.get/
Let me know if you have any questions.