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 –
|
1 |
<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> |
|
1 |
<strong>The jqgrid Code</strong> |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
<div class="sfcode"><strong><pre class="default prettyprint prettyprinted"><div class="sfcode">var myColModel = [ {<br /> name : "promoId",<br /> index : 'Promotionid',<br /> width : 60<br /> }, {<br /> name : "promoCode",<br /> index : 'promotioncode',<br /> width : 110<br /> }, {<br /> name : "name",<br /> index : 'name',<br /> width : 160<br /> }, {<br /> name : "description",<br /> index : 'description',<br /> width : 250<br /> }, {<br /> name : "distCode",<br /> index : 'distributor_code',<br /> width : 110<br /> } , {<br /> name : "statusId",<br /> hidden : true<br /> } , {<br /> name : "statusVal",<br /> index : 'status',<br /> width : 90<br /> }, {<br /> name : "startDate",<br /> index : 'start_date',<br /> width : 100,<br /> sorttype : "date",<br /> align : "right"<br /> }, {<br /> name : "endDate",<br /> index : 'end_date',<br /> width : 100,<br /> sorttype : "date",<br /> align : "right"<br /> }, {<br /> name : "discount",<br /> index : 'discount',<br /> width : 80<br /> }, {<br /> name : "extension",<br /> index : 'extension',<br /> width : 80<br /> }, {<br /> name : "isDiscount",<br /> hidden : true<br /> }, {<br /> name : "isExtension",<br /> hidden : true<br /> }, {<br /> name : "actionBtn",<br /> width : 100<br /> } ];<br /> $(function() {<br /> $("#list")<br /> .jqGrid(<br /> {<br /> url : '/suiactcodegen/action/promotion/promolist',<br /> datatype : "json",<br /> mtype : "GET",<br /> colNames : [ "Promo ID", "Promo Code", "Name",<br /> "Description", "Distributor Code", "Stt Id",<br /> "Status", "Start Date", "End Date",<br /> "Discount", "Extension", "Is Disc", "isExtn", "" ],<br /> colModel : myColModel,<br /> pager : "#pager",<br /> rowNum : 10,<br /> rowList : [ 10, 20, 30 ],<br /> sortname : "end_date",<br /> sortorder : "asc",<br /> viewrecords : true,<br /> gridview : true,<br /> rownumber : true,<br /> autoencode : true,<br /> width : '1000px',<br /> height : 'auto',<br /> caption : "Promotion Summary",<br /> gridComplete: function() {<br /> var ids = $("#list").jqGrid('getDataIDs');<br /> for (var i = 0; i < ids.length; i++) {<br /> var rowId = ids<i>,<br /> statusId = $("#list").jqGrid ('getCell', rowId, 'statusId'),<br /> activeBtn = "";<br /> if (statusId == 0) { // Inactive<br /> activeBtn = "<input type='button' value='Publish' " +<br /> "onclick='publish(" + rowId + ")' />";<br /> }<br /> //else if (statusId == 1) { // Published<br /> // activeBtn = "<input type='button' value='Expire' " +<br /> // "onclick="expire(" + rowId + ");" />";<br /> //}<br /> $("#list").jqGrid('setRowData', rowId, { actionBtn: activeBtn });<br /> }<br /> }<br /> }).jqGrid('navGrid', '#pager', {<br /> add : false,<br /> edit : false,<br /> del : false,<br /> search : true,<br /> refresh : false<br /> }).jqGrid('navButtonAdd', '#pager', {<br /> caption : " Edit ",<br /> // buttonicon: "ui-icon-bookmark",<br /> onClickButton : editPromo,<br /> position : "last"<br /> });<br /> <br /><br /> });</i></div> |
Copyright 2014 TriRand LtdAll Rights ReservedRSS
Back to Top