Invoke editor for a row upon double click
Invoke editor for a row upon double click
yet
Posts: 43Questions: 17Answers: 1
How can you invoke the editor by double clicking on a particular row ?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
With a jQuery event listener that calls
edit()
:Allan
This works in general. However with one strange effect.
Clicking on a row opens the editor windown with the form but without any action associated. I can only close the window with the ESC key.
Double click will only the editor window correctly in edit mode after having edited a row earlier using the "Edit" button...then all subsequent double clicks open the editor window in edit mode.
Yup - you'd need to use the
form-options
object to set the form options - for example:You could also use the methods such as
buttons()
andtitle()
directly - its the same effect.Allan
Not exactly what I am looking for. In particular because I have to pass in language specific strings which where already configured earlier for the forms using the i18n property. Double click should exactly behave like clicking on Edit for the selected row.
The i18n options configure the Editor
edit
button. That basically does what I've shown above (i.e. callededit()
) with whatever configuration properties are needed.If you had the edit button on the page you could calls its
action
method (button().trigger()
), but I'm not sure if you do or not.If you don't then you'd need to configure the form options as I have described above, and you could use the internationalised strings there.
Allan
This is my buttons configuration attached to the DT:
The example in https://datatables.net/reference/api/button().trigger() is confusing.
What is the index
2-1
in the example why can't I just refer to the 'edit' button?!In this case I needed
since the Edit button was the second of my buttons. Calling a button by index appears completely broken but anyway..
You can give the buttons names.
then you can use
table.button('editButton:name').trigger()
See the button-selector docs - https://datatables.net/reference/type/button-selector
I'm not clear in which way it is broken? Are you saying that using
1
doesn't work for you? That would be the correct selector to use for the button. The button selector is fully documented here.Does the trigger achieve the effect you were looking for?
Allan
What about click and dblclick together using something like this?
Could this be integrated with the "select: true" functionality?
Btw i have been using the button trigger without problem.. i wanted to use it to trigged edit button from double click.. but of course the click function today doesn't account for double-click in the way the example would do .
but this works just fine..
var mvp_table = $("#table).dataTable(....
and then i can use this to trigger the edit button.. seen on issues in chrome, firefox or safari.
mvp_table.button('editButton:name').trigger();