Forum
10:30
02/08/2013
I have used gridComplete to show HTML buttons but it shows the HTML text instead of button and encoded HTML as style which does not look good. Please help me show button instead of html text and remove or change title value.
The Output
When I inspect this cell then I could see the following in chrome tools -
<td role="gridcell" style="" title="&lt;input type='button' value='Publish' onclick='publish(100)' /&gt;" aria-describedby="list_actionBtn"><input type='button' value='Publish' onclick='publish(100)' /></td>
The jqgrid Code
var myColModel = [ { name : "promoId", index : 'Promotionid', width : 60 }, { name : "promoCode", index : 'promotioncode', width : 110 }, { name : "name", index : 'name', width : 160 }, { name : "description", index : 'description', width : 250 }, { name : "distCode", index : 'distributor_code', width : 110 } , { name : "statusId", hidden : true } , { name : "statusVal", index : 'status', width : 90 }, { name : "startDate", index : 'start_date', width : 100, sorttype : "date", align : "right" }, { name : "endDate", index : 'end_date', width : 100, sorttype : "date", align : "right" }, { name : "discount", index : 'discount', width : 80 }, { name : "extension", index : 'extension', width : 80 }, { name : "isDiscount", hidden : true }, { name : "isExtension", hidden : true }, { name : "actionBtn", width : 100 } ]; $(function() { $("#list") .jqGrid( { url : '/suiactcodegen/action/promotion/promolist', datatype : "json", mtype : "GET", colNames : [ "Promo ID", "Promo Code", "Name", "Description", "Distributor Code", "Stt Id", "Status", "Start Date", "End Date", "Discount", "Extension", "Is Disc", "isExtn", "" ], colModel : myColModel, pager : "#pager", rowNum : 10, rowList : [ 10, 20, 30 ], sortname : "end_date", sortorder : "asc", viewrecords : true, gridview : true, rownumber : true, autoencode : true, width : '1000px', height : 'auto', caption : "Promotion Summary", gridComplete: function() { var ids = $("#list").jqGrid('getDataIDs'); for (var i = 0; i < ids.length; i++) { var rowId = ids[i], statusId = $("#list").jqGrid ('getCell', rowId, 'statusId'), activeBtn = ""; if (statusId == 0) { // Inactive activeBtn = "<input type='button' value='Publish' " + "onclick='publish(" + rowId + ")' />"; } //else if (statusId == 1) { // Published // activeBtn = "<input type='button' value='Expire' " + // "onclick="expire(" + rowId + ");" />"; //} $("#list").jqGrid('setRowData', rowId, { actionBtn: activeBtn }); } } }).jqGrid('navGrid', '#pager', { add : false, edit : false, del : false, search : true, refresh : false }).jqGrid('navButtonAdd', '#pager', { caption : " Edit ", // buttonicon: "ui-icon-bookmark", onClickButton : editPromo, position : "last" }); });
12:10
Moderators
30/10/2007
Hello,
Please check your code when you build the input. It is quite possible to have some missed ' or ".
The sinple way to test is to just make a string like this:
var activeBtn = "<input type='button' value='Publish'>";
Regards
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
12:51
02/08/2013
tony said:
Hello,
Please check your code when you build the input. It is quite possible to have some missed ' or ".
The sinple way to test is to just make a string like this:
var activeBtn = "<input type='button' value='Publish'>";
Regards
Tried That. Same output. One thing. I am having n columns but returning (n-1) cells from the server
and have kept the last column for html button. Will this create a problem? Thanks!
16:26
Moderators
30/10/2007
Hello,
Set autoencode to false. Look into the docs what this means.
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
Most Users Ever Online: 715
Currently Online:
52 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66