jquery - Create multiple hyperlinks in single cell of JQGrid -



jquery - Create multiple hyperlinks in single cell of JQGrid -

i developing mvc4 application has nice client side interaction. today,i got specific requirement there can dynamic number of links in cell of jqgrid. approach taking :

create array of items in controller formatted hyperlinks in jqgrid get array jqgrid cell value , iterate each r=array item format hyperlink call controller method each hyperlink

controller piece jqgrid:

var jsondata =new {rows = (from row in dlist select new { id = row.contactorderno, cell = new string[] { convert.tostring(row.contactorderno) ,convert.tostring(row.contactorderno) ,convert.tostring(row.serialnumber) ,convert.tostring(row.modelno) ,convert.tostring(row.capacity) ,convert.tostring(new obj[]{ new {linktext="22.pdf", linksrc="mydrive\\22.pdf"}, new {linktext="33.pdf", linksrc="mydrive\\33.pdf"}) } }).toarray() }; homecoming json(jsondata, jsonrequestbehavior.allowget);

jqgrid script :

colnames: ['contract-ordernum', 'contract order number', 'serial number', 'model number', 'capacity', 'contractdetails'], colmodel: [ { name: 'modelno', width: 150, editable: false, hidden: true, editrules: { required: true } }, { name: 'contract-orderno', width: 300, editable: false, hidden: false, formatter: function (cellvalue, options, rowobject) { homecoming '<a href="/orderlist/addorder/?modelno=' + cellvalue + '" >' + cellvalue + '</a>'; } }, { name: 'serialnumber', width: 150, editable: false, editrules: { required: true } }, { name: 'modelno', width: 150, editable: false, editrules: { required: true } }, { name: 'capacity', width: 150, editable: false, editrules: { required: true } }, { name: 'contractdetails', width: 150, editable: false, formatter: function (cellvalue, options, rowobject) { homecoming '<a href="/orderlist/getpdffilestream/?rowobject=' + rowobject + '" target="_blank" >' + cellvalue + '</a>'; } } ],

please advise me workaround needed accomplish it.

i created the demo demonstrates corresponding custom formatter. in display grid

from input data

class="lang-json prettyprint-override">[ {"contactorderno":123, "serialnumber":"abc", "modelno":"modelno1", "capacity":123456, "contractdetails":[{"linktext":"12.pdf", "linksrc":"http://www.glsh.net/media/files/druckertest.pdf"}, {"linktext":"13.pdf", "linksrc":"http://www.tinten-toner-24.com/shared/pdf/testseite.pdf"}]}, {"contactorderno":456, "serialnumber":"xyz", "modelno":"modelno2", "capacity":789012, "contractdetails":[{"linktext":"22.pdf", "linksrc":"http://www.glsh.net/media/files/druckertest.pdf"}, {"linktext":"23.pdf", "linksrc":"http://www.tinten-toner-24.com/shared/pdf/testseite.pdf"}]} ]

which should generate server.

the definition of contractdetails column in demo looks below

class="lang-js prettyprint-override">{ name: "contractdetails", formatter: function (cellvalue) { var i, res = "", linkinfo; if (cellvalue == null || !$.isarray(cellvalue)) { homecoming "&nbsp;"; // empty cell in case or error } (i = 0; < cellvalue.length; i++) { linkinfo = cellvalue[i]; res += (res.length > 0 ? ", " : "") + '<a href="' + linkinfo.linksrc + '" target="_blank" >' + linkinfo.linktext + '</a>'; } homecoming res; } }

jquery asp.net-mvc asp.net-mvc-4 hyperlink jqgrid

Comments

Popular posts from this blog

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

Is there a way to convert an HTML page styled with Bootstrap CSS into email-compatible html? -