jQuery UI Widgets Forums Grid Checkboxes disappears when column has cellsrenderer

This topic contains 6 replies, has 3 voices, and was last updated by  r.ammann@microtronic.ch 8 years, 5 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author

  • fess
    Participant

    Hello!

    When checkboxes column has property cellsrenderer and you try to scroll grid, checkboxes change view and become string “true” or “false”.

    http://jsfiddle.net/fessdmks/6zeSg/


    Peter Stoev
    Keymaster

    Hi fess,

    Yes, that is by design. By setting “cellsrenderer” you override the built-in rendering which in that column is – displaying checkboxes.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/

    Hi

    I have a few questions related to the above context, as I am facing a similar issue:

    ——-
    Idea 1:
    ——-

    Is it possible to “call” this “built-in rendering” out of a custom “cellsrenderer” somehow? This way, one could use the default cell rendering on rows that shall show a checkbox and display some custom stuff on other rows. Something like this:

    myCellsRenderer = function (row, columnfield, value, defaulthtml, columnproperties) {
    if (row == 0)
    return <built-in-renderer>(row, columnfield, value, defaulthtml, columnproperties);
    else
    return <my-custom-html>;
    }

    ——-
    Idea 2:
    ——-

    Conditionally disabling checkboxes for some rows (not just ignoring clicking by returning false from “cellbeginedit”) could also be done by JQuery (something like “$(myElement).jqxCheckBox(‘disable’)”).

    But I am still looking for the right place to do so. “bindingcomplete” event is too early, as the checkboxes have not yet been created at that time (at least it looks like this for me). So, where could I put the JQuery code that enables / disables the checkboxes the way I would like to?

    ——-
    Idea 3:
    ——-

    If I create the checkboxes by myself using “createwidget” / “initwidget”, how can I link / bind the checkbox to the cell it belongs to, so the cell data is updated automatically (if I provide a “change” event handler for the checkbox, it has no parameter that gives me some kind of row reference)?

    ——-

    It would be really great if you could tell me, if one of my above ideas is somehow practicable, or if there is another way to conditionally enable / disable the checkboxes (I know that there are several discussions about that checkbox / grid topic and that it is probably not that easy) …

    Regards
    Roger


    Peter Stoev
    Keymaster

    Hi Roger,

    None of these ideas are possible. You can’t have inline editors which are always shown except the built-in editors.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Hi Peter

    Well, I must say that I had hoped for a little bit more details …

    Regards
    Roger

    P.S.:
    “createwidget” / “initwidget”, together with a bit of JQuery “magic” can do the job. Took me a few hours and a few dozen lines of code, but works … Thus, “None of these ideas are possible” is not quite true …


    Peter Stoev
    Keymaster

    Hi Roger,

    I usually do not respect the code hacks and the too much customization as this brings bugs in future development and maintenance of a project, because tomorrow if we change something small in jqxGrid your code may not work anymore.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Hi Peter

    I am well aware of the risks of this kind of code, and I usually don’t like it either (have been working as a SW engineer for about 20 years now) …

    But I found no other possibility to enable / disable or show / hide checkboxes in a grid depending on row data so far.

    That’s why I asked for ideas about how to do it until it may be supported by the grid out of the box one day …

    Regards
    Roger

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.