jQWidgets Forums

jQuery UI Widgets Forums Grid Grid columntype button call Javascript function with "buttonclick"

This topic contains 3 replies, has 3 voices, and was last updated by  Marina 6 years, 8 months ago.

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

  • andrewspak
    Participant

    Hi I have created a column with columntype button within my grid row and I want to have it dispatch or call a function in my javascript file on buttonclick. Is this possible?


    andrewspak
    Participant

    Here is the sample of my code:

    $(“#savedFcstPopGrid”).jqxGrid(
    {
    width: 780,
    sortable: false,
    autoheight: true,
    showfilterrow: false,
    filterable: false,
    rowsheight: 20,
    columnsheight: 30,
    selectionmode: “none”,
    // enablemousewheel: false,
    // scrollmode: “deferred”,
    theme: “prio_grid”,
    altrows: true,
    source: dataAdapter,
    // height: 60 + (20 * data.length),
    columns: [
    {text: ‘Forecast Id’, datafield: ‘fcstId’, hidden: true},
    {text: ‘Name’, datafield: ‘fcstName’, width: 160},
    {text: ‘(Content)<br/>Modified Date<br/>MM/DD/YYYY’, datafield: ‘modifiedDate’, width: 120},
    {text: ‘Last<br/>Submitted<br/>MM/DD/YYYY’, datafield: ‘submittedDt’, width: 120},
    {text: ‘Lead’, datafield: ‘fcstLead’, cellsalign: ‘right’, width: 100},
    {text: ‘Finalized’, datafield: ‘fcstFinalized’, cellsalign: ‘right’, width: 100},
    {text: ‘Comment’, datafield: ‘fcstComment’, cellsalign: ‘right’, width: 120},
    {
    text: ”, columntype: ‘button’, width: 60, datafield: ‘Show’, value: ‘Show’, cellsrenderer: function () {
    return “Show”;
    },
    // buttonclick: this.openFcst($(‘#savedFcstPopGrid’).jqxGrid(‘getrowdata’, $(this).jqxGrid(‘getGridParam’, ‘selrow’)))
    buttonclick: function (row) {
    this.dispatch(‘showSavedFcst’, [$(‘#savedFcstPopGrid’).jqxGrid(‘getrowdata’, row)]);
    }
    }
    ]
    });


    Hristo
    Participant

    Hello andrewspak,

    With the implementation of the “buttonclick” callback which requires the columntype: 'button'.
    Please, take a look at this demo, it demonstrates how to use it:
    https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/popupediting.htm?light
    It looks like you create your own logic to ‘dispatch’ specific information.
    Is there any error message? Or something else?
    Please, provide us with more details about what you want to achieve.

    Best Regards,
    Hristo Hristov

    jQWidgets team
    http://www.jqwidgets.com


    Marina
    Participant

    How dynamically to hide buttons on some rows based on row data? I have implemented delete button, but i need to show it only on rows with specific data for some properties of the datarecord of this row.

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

You must be logged in to reply to this topic.