Hi,
I need to invoke a dialog by pressing a key. Is this possible ?
I also want to invoke the roweditor in a datatable by pressing a key.
Any ideas ?
Regards,
Holger
Invoke dialog by keyboard
-
- Prime
- Posts: 18616
- Joined: 05 Jan 2009, 00:21
- Location: Cybertron
- Contact:
Easy, see hotkey component.
- andyba
- Expert Member
- Posts: 2473
- Joined: 31 Mar 2011, 16:27
- Location: Steinfeld, near Bremen/Osnabrück, DE
- Contact:
Well first of all you are going to have to work out how to select a row you want and then create a handler that invokes the rowEditor for the currently selected row.ITReppert wrote:Yeah,
found it :
<p:hotkey bind="ctrl+e" handler="customerDetailDialog.show();"/>
But how to invoke the roweditor ?
regards,
Holger
PF 4.x (Elite versions), PF 5, Pf 5.1, PF 6.0
Glassfish 4.1, Mojarra 2.x, Java 8, Payara 4.1.1.
If you haven't read the forum rules read them now
Glassfish 4.1, Mojarra 2.x, Java 8, Payara 4.1.1.
If you haven't read the forum rules read them now
Hi,
It should always be the actual selected row. JQuery/JScript should know which one is selected, but I don't know,
how to invoke the rowEditor. I stumbled through the Javascript, but hadn't the time to go in deeper.
Any suggestions ?
Regards,
Holger
Edit :
I found this in datable.js
but I don't know how to invoke from <p:hotkey>
that's true !Well first of all you are going to have to work out how to select a row you want and then create a handler that invokes the rowEditor for the currently selected row.
It should always be the actual selected row. JQuery/JScript should know which one is selected, but I don't know,
how to invoke the rowEditor. I stumbled through the Javascript, but hadn't the time to go in deeper.
Any suggestions ?
Regards,
Holger
Edit :
I found this in datable.js
Code: Select all
setupCellEditorEvents: function() {
var _self = this,
rowEditors = $(this.jqId + ' tbody.ui-datatable-data > tr > td span.ui-row-editor');
rowEditors.find('span.ui-icon-pencil').die().live('click', function() {
_self.showEditors(this);
});
rowEditors.find('span.ui-icon-check').die().live('click', function() {
_self.saveRowEdit(this);
});
rowEditors.find('span.ui-icon-close').die().live('click', function() {
_self.cancelRowEdit(this);
});
},
Code: Select all
_self.showEditors(this);
// Netbeans 7.2 // Glassfish 3.1.2 // Windows 7 (64 bit) // FireFox // PrimeFaces 3.4.2
So I did it like that :
Which means get css class ui-state-highlight (works with a single selection!) and find within the class ui-icon-pencil and click it.
All you need to do now is :
or
Code: Select all
<script type="text/javascript">
function clickSelectedRowPencil(){
jQuery('.ui-state-highlight').find('.ui-icon-pencil').click();
}
</script>
All you need to do now is :
Code: Select all
<p:hotkey bind="ctrl+e" handler="clickSelectedRowPencil();"/>
Code: Select all
<p:hotkey bind="ctrl+e" handler="jQuery('.ui-state-highlight').find('.ui-icon-pencil').click();"/>
// Netbeans 7.2 // Glassfish 3.1.2 // Windows 7 (64 bit) // FireFox // PrimeFaces 3.4.2
Soooooo,
got it working.
shouldn't be inside a <h:form> or inside a tag that gets updated ......
So, the above solution works.
Regards,
Holger
got it working.
Code: Select all
<p:hotkey bind="ctrl+f1" handler="clickSelectedRowPencil();" />
So, the above solution works.
Regards,
Holger
// Netbeans 7.2 // Glassfish 3.1.2 // Windows 7 (64 bit) // FireFox // PrimeFaces 3.4.2
-
- Information
-
Who is online
Users browsing this forum: Google [Bot] and 24 guests