Hi,
I am using Infragistics grid in MVC3. In the Infragistics grid i want a column to have a checkbox and this checkbox is checked based on the data from the database. Could you please guide me how to do with MVC3 razor.
thanks.
It isn't clear what you are asking here. Please also create a new thread rather than following up on a thread that is six years old for new questions. You can reference the older thread in your new post if it is relevant.
Hi Alex,
As you said , i added the script for the checkbox in my ig grid ,
$("#resultGrid").igGrid({ columns: [ { headerText: "Ballot Id", key: "BallotId", width: 100 }, { headerText: "Account Name", key: "AccountName", width: 300 }, { headerText: "Shares to vote", key: "Sharestovote", type: 'number', width: 125 }, { headerText: "Vote String", key: "VoteString", width: 125 }, { headerText: "Vote String Summary", key: "VoteStringSummary", width: 125 }, { headerText: "Voted Date", key: "LastVotedDate", width: 125 }, { headerText: "Voted FM User", key: "LastVoteFmUser", width: 125 }, { headerText: "Voted User", key: "LastVotedUser", width: 125 }, { headerText: "Iss User", key: "IssUser", width: 125 }, { headerText: "IS Selected", key: "IsSelected", dataType: "bool",width: 75, format:"checkbox" }, { headerText: "Account ID", key: "AccountID", hidden: true }, { headerText: "IsShareBlocking", key: "IsShareBlocking", hidden: true }, { headerText: "Location ID", key: "LocationID", hidden: true }, { headerText: "Meeting ID", key: "MeetingID", hidden: true }, { headerText: "pxVote User ID", key: "pxVoteUserID", hidden: true }, { headerText: "Vote cutoff Date", key: "Votecutoffdate", hidden: true }, ], features: [ { name: 'RowSelectors' }, { name: 'Selection', mode: "cell", multipleSelection: true } ], dataType: "json", width: '100%', //column resizing renderCheckboxes: true, dataSource: jQuery.parseJSON(data) //JSON Array }); } the data source from my view model [{"AccountID":5845,"AccountName":"Invesco Asia Infrastructure Fund","BallotId":83492125,"IsShareBlocking":false,"LocationID":9590,"MeetingID":1210362,"Sharestovote":17203300.00000,"Votecutoffdate":"2018-04-16T15:00:00","IsSelected":false,"pxVoteUserID":null,"IssUser":null,"VoteString":null,"VoteStringSummary":null,"LastVotedDate":null,"LastVotedUser":null,"LastVoteFmUser":null}]Can you please suggest me what to do for above ?
Hello wocasella,
igHierarchicalGrid does not render child grids initially (if they are not exapnded). My workaround with "checkMe" class is working only for the root grid. That's why this approach doesn't work for the inner level grids.
Then why you see that igHierarchicalGrid is working for two levels?
In the sample I've attached in my previous post the second level grid has "if" condition in the template. This "if" condition disables the checkboxes in the child grid.
After I've made some tests I concluded that "if" statement is working in the template only for the last level in the hierarchy.
I've attached another example in which I have this multi level checkbox problem solved.
In the sample I define function disableChecboxes:
This function contains the code from my previous post with some optimizations. For example I remove the "checkMe" class from the checkbox after I process it.
I also have a handler for "rowExpanded" event which basically calls disableCheckboxes function. When this event fires the child grid is already expanded and I can iterate through the newly created checkboxes.
Here is the code:
You can find all code in the attached sample.
Note: In 12.1 we will ship checkbox support in the columns out of the box. 12.1 is going to be available in April, so stay tuned.
Hope this helps,
Martin Pavlov
Infragistics, Inc.
Hello Martin,
Thanks for your response. That worked fine for a two level igHierarchicalGrid, but it appears that for a grid with more than two levels the problem propagates to all levels except the last one.
I've taken your working sample and applied your changes to another example with a igHierarchicalGrid with more than two levels (you can find this in the attached file).
As I see it, when we get all the elements with the "checkMe" CSS class, the only elements that are obtained are the ones for the top level grid, but not for the inner level grids.
How to go in this case?
Thanks in advance,
Walter
Hi Suresh,
FYI - starting in 12.1, this functionality will be supported out of the box in the grid, without the need to create a template:
example:
{ headerText: 'Is Postponed', key: 'IsPostponed', dataType: 'bool', width: '200px', format: 'checkbox' }
format: 'checkbox' is the new functionality. see the attached screenshot - that's how it looks like.
Hope it helps. Thanks,
Angel