jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Custom Button column button click event firing only once
Tagged: jQuery UI, jqwidgets ui grid
This topic contains 13 replies, has 2 voices, and was last updated by Yogesh Singh 11 years, 3 months ago.
-
Author
-
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 ?
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 StoevjQWidgets Team
http://www.jqwidgets.comHi 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 buttonsany suggestion on this.
thanks
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 StoevjQWidgets Team
http://www.jqwidgets.comThanks 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 renderingHi 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 StoevjQWidgets Team
http://www.jqwidgets.comThanks 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
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 ?
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 StoevjQWidgets Team
http://www.jqwidgets.comThanks 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
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 StoevjQWidgets Team
http://www.jqwidgets.comPeter, 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
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 StoevjQWidgets Team
http://www.jqwidgets.comi 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
-
AuthorPosts
You must be logged in to reply to this topic.