Hi all,
I have a igGrid and i want to add a column with one ACTIONLINK or similar.
When i clicked the action link i want to go other view with other action to show row details in other view.
another option would be, on double click on the row, go directly to another view
It's this possible?
a lot of thanks for advance
Hi Ruben Ordonez,
You can use an unbound column to acheive your goal.
Inside the unbound golumn you can create anchor tag uising Template. Here is an example:
column.Unbound(
"UnBound").Template("<a href='/Home/Details/${ID}'>Details</a>").Width("100px").HeaderText("Details");
This code Navigate to Details ActionView of the Home controller, and it's passing ID property of my model to the ActionView, where you can add extra logic to get the details for that specific row of the grid and display them in a suitalble to your case way.
Thanks,
Todor Paskalev
Infragistics
Hi Todor,
thanks for help, I try to do this but i Can't, when i put column.Unbound the intilesense doesn't show this option and don't work
my version of infragistics.Web.MVC is 3.11.1.2118, probably i need a version more actual? this version don'y have this option? my licenced packaged from infragistics is: NetAdvantatge 2011.1
a lot fo thanks for advance
Hi Martin,
it's great, I do this and i capture the double click event, but i don't understand everything,
the rowid part doesn't show anything if i put some alerts messages
I put my code here:
Javascript code
<script type="text/javascript"> $("#igGrid1>tbody>tr").live("dblclick", function (e) { alert("Doble click"); e.preventDefault(); e.stopPropagation(); alert("Antes de row"); var $row = $(e.target).closest("tr"); alert($row); var rowId = $row.attr("data-id"); alert(rowID); window.location.href = "home/details/" + rowId; // or use window.open });</script>
<div style="width:95%;float:left;"> @( Html.Infragistics().Grid<Comics>() .ID("igGrid1") .Columns(column => { column.For(x => x.ID).DataType("Guid").HeaderText("ID"); column.For(x => x.Nombre).DataType("string").HeaderText("Nombre"); column.For(x => x.Numero).DataType("int").HeaderText("Numero"); column.For(x => x.SuperHeroe).DataType("string").HeaderText("Super Heroe"); column.For(x => x.Escritores).DataType("string").HeaderText("Escritores"); column.For(x => x.Dibujantes).DataType("string").HeaderText("Dibujantes"); @*column.Unbound("UnBound").Template("<a href="'/Documento/Details/${ID}'>Details</a>").Width("100px").HeaderText("Detalles");*@ }) .Features(features => { features.Paging().PageSize(20).PrevPageLabelText("Previous").NextPageLabelText("NEXT"); features.Sorting().Mode(SortingMode.Single).ColumnSettings(settings => { settings.ColumnSetting().ColumnKey("Numero").AllowSorting(true);
}); features.Selection().MouseDragSelect(true).MultipleSelection(true).Mode(SelectionMode.Row); features.Filtering().ColumnSettings(settings => { settings.ColumnSetting().ColumnKey("Nombre").AllowFiltering(true).FilterCondition("equals"); }); }) .PrimaryKey("ID") .ClientDataSourceType(ClientDataSourceType.JSON) .DataSourceUrl(Url.Action("GetComicsList")) .Width("100%") .Height("350") .LocalSchemaTransform(true) .DataBind() .Render() ) </div>
I set the property PrimaryKey with my primary key from my dataBase Table
A lot of thanks for your time
Hello Ruben,
What I see is that you pass some invalid arguments to the DataType method like "Guid".
The valid arguments are "number", "string", "bool", "date", "object".
For the ID column you should put "string" or "number".
If this doesn't help, can you inspect the generated JavaScript code for the grid (open the page source and search for "igGrid1". There will be a JavaScript code with te grid configuration) and paste it for me to see.
Hope this helps,
Martin PavlovInfragistics, Inc.
it's does'nt works i put the code:
Hi Ruben,
There is nothing peculiar in this code, so I'm not sure what the problem is. Can you inspect the grid TR element in order to see if there is a "data-id" attribute.
igGrid adds this attribute (with the value from the primary key) to the TR element when primaryKey property is defined for the grid. In the code I use this attribute in order to get the PK value of the row.
Also what version (and build) of Ignite UI controls, jQuery and jQuery UI are you using?
Thanks in advance,Martin PavlovInfragistics, Inc.
Hi , Martin
I don't see anything of TR element in my code... when I do:
var rowId = $row.attr("data-id");
my var rowId get the value = Undefined...
version of my components is : netAdvantatge 2011.1 it's that as you need?
i'm going crazy with this!!!
thanks for advance!
A lot of thanks Martin, without your help I can't resolve my issue!!!
My bad. The "data-id" attribute is not available in 11.1 version. I forgot about that. It seems that you've found the only possible solution.
I'm glad that you were able to resolve your issue.
Good luck,Martin PavlovInfragistics, Inc.
Finally i found the solution:
with this code you can't get the value of the row that you like, lot of than martin!
$('#igGrid1 td').live("dblclick", function (e) { var $this = $(this); var row = $this.closest("tr"); //var cell2text = row.find('td:eq(1)').text(); Como coger otros valores de otra celda var rowID = row.find('td:first').text(); window.location.href = "Documento/Details/" + rowID; });