Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
195
igGrid Data select Id from current row in template
posted

I'm using an igGrid in ASP.NET MVC (Javascript). 

This is my code:

$("#gridPpm").igGrid({
autoGenerateColumns: false,
width: "100%",
columns: [
{ headerText: "Ppm Id", key: "PpmId", dataType: "number", width: "55px" },
{ headerText: "Vendor", key: "Vendor", dataType: "string", width: "200px" },
{ headerText: "Total PPM", key: "TotalPpm", dataType: "number", width: "110px" },
{ headerText: "Internal Stop", key: "InternalStop", dataType: "number", width: "130px" },
{ headerText: "Customer Stop", key: "CustomerStop", dataType: "number", width: "140px" },
{ headerText: "Score Price", key: "ScorePrice", dataType: "number", width: "130px" },
{ headerText: "Timestamp", key: "DtTimestamp", dataType: "string", width: "140px" },
{
headerText: "Actions",
key: "Actions",
dataType: "string",
template:
"<input type=\"button\" value=\"View\" data-id=\"${Id}\" class=\"btn btn-fremach-gr\" onclick=\"location.href = '@Url.Action("ViewPpm", "SupplierEvaluation", new { PpmId })'\"/>"
}
],
dataSource: ds.dataView(),
responseDataKey: "results",
features: features
});

I have a button in the Template where I want to go to an action in my controller when clicked on. Here I have to pass the PpmId for this row. How do I do that here? Is this possible?

Parents
No Data
Reply
  • 195
    Offline posted

    I found the solution.

    I changed the template to:
    <input type=\"button\" value=\"View\" data-id=\"${Id}\" class=\"btn btn-fremach-gr\" onclick=\"location.href = '/SupplierEvaluation/ViewPpm/${PpmId}'\"/>

    This works!

Children