General Question: Has anyone implemented 'click row to open edit modal'?
See original GitHub issueI’m working on removing the ‘Edit’ button from the interface so that the user just needs to click on a row and have it open the edit modal. So far, I’ve done the following:
- Removed the ‘Edit’ button from the DOM by not declaring
dom: 'Bfrtip'
in my datatable configuration. - Determined the selected row and called openEditModal():
$("[id^='my_datatable_'] tbody").on( 'click', 'tr', function () {
var tableID = $(this).closest('table').attr('id'); // id of the table, e.g., my_datatable_123
theDataTable.row(':eq(0)', { page: 'current' }).select();
$( '#'+tableID )[0].altEditor._openEditModal();
});
The above code opens the edit modal, pre-filled with the datatable data. However, when I edit a field/form input, the changes are not being saved. If I remove my row-click selection functionality and just use AltEditor as designed, my SQL/database code is working and the updates are saved so clearly I’m missing something.
Has anyone implemented a ‘click a row to open an AltEditor modal’? I’m looking for code to review to see if I can determine where I’m going wrong. Thanks.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5
Top Results From Across the Web
Display specific row data in bootstrap modal with edit button ...
I have tried the solution found on stackoverflow "Pull information from mysql table to bootstrap modal to edit" by link. But could not...
Read more >Inline editing or modal popup - UX Stack Exchange
Creating a new record, or changing many fields of a record when the total columns are large in numbers. Then it makes sense...
Read more >How to keep Editor modal window open (single entry) for ...
Hello, I would like to edit a single entry and allow the user to submit the form without it closing thus allowing them...
Read more >How To Implement a Modal Component in React - DigitalOcean
Build a modal component in your React project using props and state ... Your project will display and close a modal upon clicking...
Read more >Modal Windows in Service Portal - ServicePortal.io
Below is a simple example of how to open up a modal window: ... I posted some service portal questions on the SN...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
You can try this:
$(document).delegate(...)
is performed afteron('click', ...)
, so row is already selectedThanks again @luca-vercelli
The
$(document).delegate
code above works perfectly in my application.