Monday 19 January 2015

Add custom action link to jqGrid row | pravin pajapati


Add custom action link to jqGrid row.

function showDetail(id){
//do somthing here...
alert(id);
}

colNames: ['ID',''],
 colModel: [
    { name: "ID", key: true, index: "ID", sortable: false, hidden: true }
                  ,{ name: 'action', align: 'center', width: 25, sortable: false
                      , title: false, fixed: true, search: false
                      , formatter: function (cellvalue, options, rowObject) 
                      { var stImageLinks = '<a title="action tooltip" 
                             onclick="showDetail(\'' + (rowObject.ID) + '\') + '\');"
       href="#"><img src="../images/edit.png" /></a>';
                                            return stImageLinks;
                                        }
                                    }
  },

hope it's useful for you. thank you. Pravin Prajapati

1 comment:

  1. colModel: [

    {
    name: 'dcn', index: 'dcn', width: 45, jsonmap: "dcn", formatter: function (cellvalue, options, rowObject) {

    var x = '@Html.ActionLink("dcn1", "GetData", "DocList", new { dcn = "dcn" },new { @style = "color:Blue;font-weight:bold;" })';
    x = x.replace("dcn1", cellvalue);
    x = x.replace("dcn", rowObject['dcn']);
    return x;
    }
    },

    ReplyDelete