jQuery UI Widgets Forums Grid Drag and Drop and everpresentrow

This topic contains 1 reply, has 2 voices, and was last updated by  Hristo 2 years, 11 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • Drag and Drop and everpresentrow #93218

    arkgroup
    Participant

    I have grid with everpresentrow function to add new row.
    When I add drag and drop capability on rendered function:

      rendered: function (type) {
                            // select all grid cells.
                            var gridCells = $('#jqxGrid').find('.jqx-grid-cell');
                            // initialize the jqxDragDrop plug-in. Set its drop target to the second Grid.
                            gridCells.jqxDragDrop({
                                appendTo: 'body', dragZIndex: 99999,
                                dropAction: 'none',
                                initFeedback: function (feedback) {
                                    feedback.height(25);
                                },
                                dropTarget: $('#jqxGrid1'), revert: true
                            });
                            gridCells.off('dragStart');
                            gridCells.off('dragEnd');
                            gridCells.off('dropTargetEnter');
                            gridCells.off('dropTargetLeave');
                            // disable revert when the dragged cell is over the second Grid.
                            gridCells.on('dropTargetEnter', function () {
                                gridCells.jqxDragDrop({ revert: false });
                            });
                            // enable revert when the dragged cell is outside the second Grid.
                            gridCells.on('dropTargetLeave', function () {
                                gridCells.jqxDragDrop({ revert: true });
                            });
                            // initialize the dragged object.
                            gridCells.on('dragStart', function (event) {
                                var value = $(this).text();
                                var position = $.jqx.position(event.args);
                                var cell = $("#jqxGrid").jqxGrid('getcellatposition', position.left, position.top);
                                $(this).jqxDragDrop('data', {
                                    value: value
                                });
                            });
                            // set the new cell value when the dragged cell is dropped over the second Grid.      
                            gridCells.on('dragEnd', function (event) {
                                var value = $(this).text();
                                var position = $.jqx.position(event.args);
                                var cell = $("#jqxGrid1").jqxGrid('getcellatposition', position.left, position.top);
    
                                if (cell != null) {
                                     
                                        $("#jqxGrid1").jqxGrid('setcellvalue', cell.row, cell.column, value);
                                     
                                    }
                               
    
                            });
                        },

    I cannot add new row using everpresentrow, cannot even click on that row. Everything works if I remove all rendered code…

    Thanks

    • This topic was modified 2 years, 11 months ago by  arkgroup.
    • This topic was modified 2 years, 11 months ago by  arkgroup.
    Drag and Drop and everpresentrow #93247

    Hristo
    Participant

    Hello arkgroup,

    Thank you for the feedback.
    I would suggest you if you want to try a workaround – create empty fields above (or under) the Grid as an alternative of the everpresentrow.
    Also, you could use empty Grid sticked with no rows and columns, just with one row to the Master Grid.
    Add recorded data to the Master Grid – var value = $('#jqxGrid').jqxGrid('addrow', rowid, {});.

    Best Regards,
    Hristo Hristov

    jQWidgets team
    http://www.jqwidgets.com

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

You must be logged in to reply to this topic.