jQWidgets Forums

jQuery UI Widgets Forums Grid Custom Button column button click event firing only once

This topic contains 13 replies, has 2 voices, and was last updated by  Yogesh Singh 11 years, 3 months ago.

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

  • Yogesh Singh
    Participant

    I have a button column definition in the grid as below

    { text: ‘Actions’, width: ‘15%’, cellsalign: ‘center’, cellsrenderer: function (row, column, value) {
    var viewType = $(“#divManageViewGrid”).jqxGrid(‘getcellvalue’, row, ‘VIEW_TYPE’);
    if (viewType == “Shared”) {
    return ‘<input type=”button” class=”button-link” id=”btnRemove” value=”Remove”/>’;
    }
    return ‘<input type=”button” class=”button-link” id=”btnDelete” value=”Delete”/>’;
    }
    }

    this is the button click event
    $(document).on(‘click’, “.button-link”, function () {
    var row = $(“#divManageViewGrid”).jqxGrid(‘getselectedrowindex’);
    id = $(“#divManageViewGrid”).jqxGrid(‘getrowid’, row);
    var offset = $(“#divManageViewGrid”).offset();
    $(“#popupWindow”).jqxWindow({ position: { x: parseInt(offset.left) + 500, y: parseInt(offset.top) + 20} });
    // show the popup window.
    $(“#popupWindow”).jqxWindow(‘show’);

    });

    the button click event fires only once whats the issue here? can anyone help me on this ?


    Peter Stoev
    Keymaster

    Hi Yogesh,

    Please, look at the Popup Editing demo available online. There is a Button column in the sample and is shown how Clicks are expected to be handled.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com


    Yogesh Singh
    Participant

    Hi Peter

    Mine is a custom buttom column and the button click works fine if i comment out the popup window code.
    I used button column before and this same scenario was working fine but now the requirement is changed so i had to use column with multiple buttons

    any suggestion on this.

    thanks


    Peter Stoev
    Keymaster

    Hi Yogesh,

    If you want to render multiple custom buttons or even links, we have a demo about that, too. Example: http://www.jqwidgets.com/jquery-widgets-demo/mobiledemos/jqxgrid/editing.htm.

    Hope this helps.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com


    Yogesh Singh
    Participant

    Thanks for the reply peter
    It didnt work this way also..only with popup this problem is happening if i remove the code that opens the popup it the button click works fine and fires multiple times it gets clicked..though it works perfectly with the button column but i dont understand why its not working with custom button rendering


    Peter Stoev
    Keymaster

    Hi Yogesh,

    According to me, it will not because the following code:

    var row = $(“#divManageViewGrid”).jqxGrid(‘getselectedrowindex’);
    id = $(“#divManageViewGrid”).jqxGrid(‘getrowid’, row);
    

    takes the ID of a selected row, but clicking a button or link will not make a Row selection. However, the code seems to take into account that clicking the button, selects the row, too.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com


    Yogesh Singh
    Participant

    Thanks Peter i didnt fully understand by your comment but the thing is its not actually goin to the click event once the popup gets opened otherwise its working as usual and seems to work fine if i use a button column but with custom button unless and until i dont open a popup the button click event firing every time


    Yogesh Singh
    Participant

    Moreover If i use column type button then its working perfectly its goin to the event everytime regardless of popup opening or closing but this way i cant hide a button in a cell can I ? and with custom button column i can hide a button in a cell but its event doesnt fire once a popup opens..any help on this ?


    Peter Stoev
    Keymaster

    Hi Yogesh,

    It is not possible to hide a button in a cell. The “buttonclick” callback would be always called when the button is clicked. However, inside that function, you can add code which checks which button is clicked and perform or not your custom action.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com


    Yogesh Singh
    Participant

    Thanks peter but its not even goin to the click event of the button of any row once the popup opens the entire column withe custom buttons becomes unusable


    Peter Stoev
    Keymaster

    Hi Yogesh,

    That depends on whether the Popup is Modal or not. When a Modal Popup is displayed, the other content on the entire web page is not accessible.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com


    Yogesh Singh
    Participant

    Peter, popup is modal and when i click on cancel to hide the popup and click on the edit button which opens a popup in that row or any row for that matter button click event stops firing this is a case with custom button column if i use a columntype button i am getting button click everytime why this difference or how can i accomplish this


    Peter Stoev
    Keymaster

    Hi Yogesh,

    The difference is because you attach to click events like that: $(document).on(‘click’, “.button-link”. You should do it as shown in any of the demos I already pointed you out.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com


    Yogesh Singh
    Participant

    i tried that way also Peter but its not workin meaning its workin as long as i dont open a popup and only way its workin if i go for button type column but as you said i wont be able to hide buttons otherwise if i go for custom column this problem persits i dont understand the difference in button type column click and custom button click why one works and the other one doesnt in case of pop up opening

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

You must be logged in to reply to this topic.