I want to create a custom button in the doctype list view that does some actions (export selected files into a specific format for example). What do I need to do to achieve it?
Edit: After a while, I’m able to add a button to this list view, but I still don’t know how to get the selected items.
@Duc_Minh_Nguyen First, welcome to ERPNext community.
Second, you can get the selected rows by calling the following method from inside the onload
function. Assuming that the variable received by the onload
function is called listview
, then you can call listview.get_checked_items(true)
to only get the list of docnames
of the selected rows, or remove the true
argument if you want to get the list of doc objects that represents the columns & values of each selected row.
I hope that I was helpful.
If my answer is what you where looking for, please don’t forget to mark this post as the answer to help other users to easily find it.
1 Like
Thank you a lot! It worked!