jQWidgets Forums

Forum Replies Created

Viewing 1 post (of 1 total)
  • Author
    Posts

  • mrwest
    Blocked

    Hello Peter,

    Ok, thanks for information, however; we had to enable this possiblity to have multiple icons in one cell that represents functions outside of grid. We did find a workaround that does not affect the grid what I’ve seen so far. In short, we are passing a custom HTML element containing a function which is required to be realized upon click.

    What I did was adding a click event on the parent element containing jqxGrid. This allowed me to check for a specific class and execute function.
    Ill paste the code snippet from our object if someone else might find it useful.

    Regards,
    Jan

        initOptionClick: function() {
    
            var _this = this;
            this.customDataGrid.off('click.rowclickoption');
            this.customDataGrid
                .on('click.rowclickoption', function (clickevent) {
                    // get target 
                    var $target = $(clickevent.target);
                    // check if target has click function, if not, check parent and set as target if it exists.
                    if (!$target.hasClass('webster-jqx-grid-row-click-option')) {
                        if (!$target.parent().hasClass('webster-jqx-grid-row-click-option')) return;
                        else $target = $target.parent();
                    };
    
                    // get json data from target if it exists
                    var objJson = $target.attr('data-json') || {};
                    // parse if objJson is string 
                    if (typeof (objJson) === 'string') objJson = JSONfn.parse(objJson);
                    // execute the "onClick" property function 
                    if (typeof objJson.onClick === 'function') {
                        objJson.onClick({ clickevent: clickevent, customDataGrid: _this, objectData: objJson, selectedRecords: _this.selectedRecords() });
                    }
                });
        },
Viewing 1 post (of 1 total)