MVC Custom Column Infrastructure Support

I am currently using ASP.NET MVC assistants in MVC4 with the Infragistics igGrid control and am looking for a way to insert a custom column to implement AJAX calls for CRUD functions. The only solutions I found related to representing an object that is not an option in the current architecture. Essentially, I just need to know how to add a new column, which may contain a simple href, to call an existing REST API that references the model in a particular row.

Here is what I still have ...

<div class="queue-grid"> @( Html.Infragistics().Grid(Model).Columns( c => { c.For(m => m.DateSubmitted).HeaderText... c.For(m => m.RequestorName).HeaderText... c.For(m => m.OrganizationName).HeaderText(... c.For(m => m.CategoryName).HeaderText(... c.For(m => m.DesiredCompletionDate).HeaderText(... c.For(m => m.ChargeCode).HeaderText(... c.For(m => m.ApprovingManagerName).HeaderText(... c.For(m => m.Description).HeaderText(... c. //Edit function c. //Delete function .... 
+4
source share
2 answers

I would use a column template: http://www.infragistics.com/products/jquery/sample/grid/basic-column-template

 column.For(x => x.ProductID).HeaderText("Delete").Template("<a href=javascript:DeleteProduct('${ProductID}');>Delete</a>").Width("150"); 

Try using this column to delete.

+3
source

In the upcoming release of jQuery controls (2012.2 - very soon), you will be able to identify an unrelated column with which you can solve your case.

What @Boone offers will be absolutely correct - the only difference is that instead of a data-bound column (ProductID in this sentence) that will display these column values ​​in the grid, you can define a space for the column.

You can then define a template for this empty (non-data-related) column in which you can place links, buttons or anything else that you like.

0
source

Source: https://habr.com/ru/post/1438460/


All Articles