jQuery UI Widgets › Forums › Grid › Custom column with different href and different value in html
Tagged: cellsrenderer, column, custom, grid, jqxgrid, Link, linkrenderer, template
This topic contains 2 replies, has 2 voices, and was last updated by Bushwacka 11 years, 10 months ago.
-
Author
-
Hello, i tried your custom column function from this webpage http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/index.htm#demos/jqxgrid/customcolumn.htm
I would like to do get different values in HTML element and in href attribute of that element, is it possible? Because when i open the HTML that was executed for example for the first value of the row of the table is this:
<a target="_blank" href=" http://www.jqwidgets.com/community/topic/combobox-autocomplete-type/"> http://www.jqwidgets.com/community/topic/combobox-autocomplete-type/</a>Below are the datafields that are in your script on same webpage:
{ name: 'title', type: 'string' }, { name: 'link', type: 'string' }, { name: 'pubDate', type: 'date' }, { name: 'creator', map: 'dc\\:creator', type: 'string' },First two values of the first row of the table are:
LINK: http://www.jqwidgets.com/community/topic/combobox-autocomplete-type/
TITLE: Reply To: ComboBox autocomplete typeIs possible to do that the TITLE would be value in the HTML element and LINK would be in href attribute like beneath?
<a target="_blank" href=" http://www.jqwidgets.com/community/topic/combobox-autocomplete-type/"> Reply To: ComboBox autocomplete type </a>Hello Bushwacka,
Here is how to modify the linkrenderer function to achieve your requirement:
var linkrenderer = function (row, column, value) { if (value.indexOf('#') != -1) { value = value.substring(0, value.indexOf('#')); } var title = $('#jqxgrid').jqxGrid('getcellvalue', row, "title"); return "<a href='" + value + "' target='_blank'>" + title + "</a>"; }Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/That’s perfect!
Thank you very much 🙂
Daniel
-
AuthorPosts
You must be logged in to reply to this topic.