jQWidgets Forums

jQuery UI Widgets Forums Grid editable column with createwidget

This topic contains 3 replies, has 2 voices, and was last updated by  jeffo 8 years, 1 month ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • editable column with createwidget #92284

    jeffo
    Participant

    According to the documentation…
    createwidget – sets a custom function which is called when a widget in a cell is created. You can use this callback function to create a custom read-only column which displays widgets in the cells.

    Is it possible to have a cell, using createwidget but also editable using the built in editable controls (date for example)?

    For example, can I display a date value which becomes a datepicker when clicked, or if there is no date value, a button which will set a date value to a default date?

    Thanks

    editable column with createwidget #92293

    Peter Stoev
    Keymaster

    Hi jeffo,

    No I do not think so, because when you click on the widget, its click event will be handled by it, i.e it will not open a cell for edit. However, you can also update Grid cell values by using the Grid’s setcellvalue method.

    Best Regards,
    Peter Stoev

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

    editable column with createwidget #92297

    jeffo
    Participant

    Thanks Peter.

    I am using knockoutjs to bind the data; and cellsrenderer to define html for my custom button (or data if it isnt null). createwidget sets the click event of the button to update the date, and call updatebounddata to update the grid. initwidget is empty.

    Can you please suggest where in the javascript the cell is set to edit mode? Perhaps I can implement something external to the grid to switch modes when the date is displayed as opposed to the button? (to give my client what they are asking for)

    editable column with createwidget #92312

    jeffo
    Participant

    Peter

    As an update I managed to achieve what I wanted by removing the createwidget and initwidget methods to enable the cell to access edit mode. I format the html in cellsrenderer and manage the click (if required) in cellbeginedit. cellbeginedit either handles the click event, and returns false to prevent the edit, or returns to enable the cell to transition to edit mode automatically.

    I hope this is an acceptable method, because it (seems) to be working as expected.

    thanks.

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

You must be logged in to reply to this topic.