jQWidgets Forums

jQuery UI Widgets Forums Grid Apply style for cell text if checkbox checked.

This topic contains 2 replies, has 1 voice, and was last updated by  Arsen Bespalov 12 years, 3 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • I use this update script:


    ...
    updaterow: function(rowid, rowdata, commit) {
    var data = "update=true&" + $.param(rowdata)
    $.ajax({
    dataType: 'json',
    url: 'grid_data.php',
    data: data,
    cache: false,
    success: function(data, status, xhr) {
    commit(true)
    },
    error: function (jqXHR, textStatus, errorThrown) {
    commit(false)
    }
    })
    }
    ...

    if I toggle checkbox in grid column, script updated DB, but I don’t know how to modify style cell in this grid if checkbox toggle.

    Maybe an idea?

    I understood!

    There is no need use updaterow function, just use cellsrenderer.

    Sample cellsrenderer function:

    var cellsrenderer = function (row, columnfield, value, defaulthtml, columnproperties) {
    var data = $("#jqxgrid").jqxGrid('getrowdata', row);
    if (data.isCheck) {
    return '<span style="margin: 4px; float: ' + columnproperties.cellsalign + '; font-weight: bold; text-decoration: underline">' + value + '</span>';
    } else {
    return '<span style="margin: 4px; float: ' + columnproperties.cellsalign + '; font-weight: normal;">' + value + '</span>'
    }
    }

    Where variable isCheck is a input checkbox.

    Or easy just:

    var cellsrenderer = function (row, columnfield, value, defaulthtml, columnproperties) {
    var data = $("#jqxgrid").jqxGrid('getrowdata', row);
    if (data.isCheck) {
    return '<span style="margin: 4px; float: ' + columnproperties.cellsalign + '; font-weight: bold; text-decoration: underline">' + value + '</span>';
    } else {
    return defaulthtml;
    }
    }
Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.