jQuery UI Widgets Forums Grid link in a cell

Tagged: ,

This topic contains 5 replies, has 2 voices, and was last updated by  gisernia 12 years, 2 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • link in a cell #16994

    gisernia
    Participant

    I need to put a link in a cell

    scenario

    set in a cell the value

    THE_LINK=

    <a href="?module=xxxx&amp;applettype=yyyy&amp;record=ID">fieldvalue</a>

    where ID is in:

    var source =
    {
    datatype: “json”,
    datafields: [
    { name: ‘ID’},
    { name: ‘FST_NAME’},
    { name: ‘LST_NAME’}

    ],

    and columns are:

    columns: [
    { text: ”, datafield: ‘FST_NAME’, width: 200, cellsrenderer: THE_LINK},
    { text: ”, datafield: ‘LST_NAME’, width: 180 }

    ]

    How can I do?

    thanks giulio

    link in a cell #17003

    Peter Stoev
    Keymaster

    Hi giulio,

    Here’s a sample with Column with Links: customcolumn.htm.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    link in a cell #17014

    gisernia
    Participant

    yes,
    the sample is ok,
    but how can I calll the field ID inside the renderer function?

    thanks
    Giulio

    link in a cell #17047

    Peter Stoev
    Keymaster

    Hi Giulio,

    To get the row’s id, you may use the “getrowid” method. It accepts as parameter the row’s index which is passed to the “cellsrenderer” callback function used for rendering the links.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    link in a cell #17186

    gisernia
    Participant

    I use this function
    var linkrenderer = function (row, column, value) {
    if (value.indexOf(‘#’) != -1) {
    value = value.substring(0, value.indexOf(‘#’));
    }

    var format = { target: ‘”_blank”‘ };
    var html = $.jqx.dataFormat.formatlink(value, format);

    return html;

    and it’s ok to retrieve column data.

    But id is not in the row, it’s only in the source

    var source =
    {
    datatype: “json”,
    datafields: [
    { name: ‘id’},
    { name: ‘FST_NAME’},
    { name: ‘LST_NAME’},
    ],

    and in grid definition I have:

    columns: [
    { text: ”, datafield: ‘FST_NAME’, width: 200, cellsrenderer: linkrenderer},
    { text: ”, datafield: ‘LST_NAME’, width: 180 },
    ]

    I’d like to retrieve the id value!!

    thanks
    Giulio

    link in a cell #17576

    gisernia
    Participant

    RESOLVED:

    this is the linkrender function:

            var linkrenderer_accounts = function (row, column, value) {
    if (value.indexOf('#') != -1) {
    value = value.substring(0, value.indexOf('#'));
    }
    href = source.records[row].ID;
    var html = "<a href=\"?module=accounts\&applettype\=baseview\&ret_module=accounts\&ret_applettype\=listview\&record="+href+"\">"+value+"</a>";
    return html;
    };
Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.