Hi... how can I generate a rowtemplate with a column hidden? That column will have the PrimaryKey of the table.
My code is omething like this
@( Html.Infragistics().Grid<Feed>() .ID("grdFeeds") .UpdateUrl("EditingSaveChanges") .PrimaryKey("ID") .AutoGenerateColumns(false) .AutoCommit(true) .JQueryTemplating(true) .RowTemplate("<tr><td>${ID}</td><td>${Nombre}</td><td>${Letras}</td><td>${RutaIn}</td><td>${RutaOut}</td></tr>") .Columns(column => { column.For(x => x.ID).HeaderText("ID").Hidden(true); column.For(x => x.Nombre).HeaderText("Name"); column.For(x => x.Letras).HeaderText("Letters"); column.For(x => x.RutaIn).HeaderText("In Folder"); column.For(x => x.RutaOut).HeaderText("OutFolder"); } ) .Features(features => { features.Filtering(); features.Paging().PageSize(20).PrevPageLabelText("Previous").NextPageLabelText("NEXT").ShowPageSizeDropDown(false).ShowPagerRecordsLabel(false); features.Selection().MouseDragSelect(true).MultipleSelection(true).Mode(SelectionMode.Row); features.Sorting().Mode(SortingMode.Single); features.Selection().Mode(SelectionMode.Row).MultipleSelection(false); features.Updating().EnableAddRow(false).EditMode(GridEditMode.None); }) .DataSourceUrl(Url.Action("GetFeeds")) .Width("100%") .Height("500px") .DataBind() .Render() )
but its rendering like
Thanks
Hello,
You can try to set display style to none for this column.
Your row template string should look like this:
However this approach doesn't seem to work in Firefox(10.x.x).
I assume that you want to use ID column in your code. If that is the case there is a better solution.
When you set primaryKey property (PrimaryKey("ID")) igGrid adds "data-id" attribute to each row which value is set to the ID column value. ( Note: you don't need to define ID column in columns array.)
Now you can get the ID value in jQuery like this:
var id = $(row).attr("data-id"); where row is DOM element.
The following code gets ID column for selected rows:
Hope this helps,
Martin Pavlov
Infragistics, Inc.