Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_Related Related Topics sp_TopicIcon
JqGrid: Showing text for HTML elements inside column
02/08/2013
10:30
Avatar
abhihello123
Member
Members
Forum Posts: 4
Member Since:
02/08/2013
sp_UserOfflineSmall Offline

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

outputImage Enlarger

When I inspect this cell then I could see the following in chrome tools -

<td role="gridcell" style="" title="&amp;lt;input type='button' value='Publish' onclick='publish(100)' /&amp;gt;" aria-describedby="list_actionBtn">&lt;input type='button' value='Publish' onclick='publish(100)' /&gt;</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" }); });

02/08/2013
12:10
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

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.

02/08/2013
12:51
Avatar
abhihello123
Member
Members
Forum Posts: 4
Member Since:
02/08/2013
sp_UserOfflineSmall Offline

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!

02/08/2013
16:26
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

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.

02/08/2013
17:03
Avatar
abhihello123
Member
Members
Forum Posts: 4
Member Since:
02/08/2013
sp_UserOfflineSmall Offline

tony said:

Hello,

Set autoencode to false. Look into the docs what this means.


Hi Tony,

Forgot to mention I tried it already. I think that is used for data coming from server but this is something I am adding

locally. it didn't work.

03/08/2013
14:24
Avatar
abhihello123
Member
Members
Forum Posts: 4
Member Since:
02/08/2013
sp_UserOfflineSmall Offline

Sry I copied the basic grid from JqGrid site and then edited that and didn't notice

that autoencode:true for grid level. So even though I mentioned it for column level it wasn't working. Now it appears.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 496

Currently Online:
22 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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information