Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
2 Vastaukset
2650 Näkymät

Hi, I want to add one button in treeview to sync many records from another app API .

Specific activities are as follows
1. Add a button in the list view (can replace the button with the menu item also) to call server action
2. When the button is pressed, there is a loading panel when calling the server action
3. After the action is successful, reload the List view and turn off the loading panel

I would like to ask if I can find any documents to learn how to do the above tasks? Or can you show me how to do it?

My server action is a function in the model.

Here is an example image link of the position of the button or menu item that I want to add:


https://www.screencast.com/t/9GbA8bxJu8P2



Avatar
Hylkää
Paras vastaus

1) Add an XML template that inherits the ListView buttons and add your new Button.
File path: your_module/static/src/xml/new_button.xml

2) Add a JavaScript module to extend the ListController to add events to your new Button and make an RPC request to your model that has the method you want to trigger.
File path: your_module/static/src/js/new_button.js

Here is a full source code example in my github gists.




Happy to help :) an upvote will be awesome

Avatar
Hylkää
Tekijä

Thanks for your example. I need to declare xpath for the js file in view too, right?

Tekijä Paras vastaus

Thanks for your example. I need to declare xpath for the js file in view too, right?

Avatar
Hylkää
Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
0
heinäk. 17
4315
0
jouluk. 23
1384
1
huhtik. 24
13074
1
lokak. 19
7046
1
elok. 19
6674