Developer forum

Forum » Dynamicweb 10 » Implement custom action

Implement custom action

Andrejs Zavorotnijs
Reply

Hello

Is there any example code, how to implement custom action function, I didn't find any.

Let say new action in order list page and in order details page with custom function (order export)


Replies

 
Jeppe Eriksson Agger Dynamicweb Employee
Jeppe Eriksson Agger
Reply

Hi Andrejs,

To add list actions to an existing list screen, you need to make a screen injector.

Here's an example of how to implement a list screen injector for adding actions to the screen:

using Dynamicweb.CoreUI.Actions;
using Dynamicweb.CoreUI.Screens;
using Dynamicweb.Ecommerce.UI.Models;
using Dynamicweb.Ecommerce.UI.Screens;

namespace ScreenInjectorsDemo;

public class OrdersListScreenInjector : ListScreenInjector<OrderListScreen, OrderListDataModel, OrderDataModel>
{
    public override IEnumerable<ActionGroup>? GetScreenActions()
    {
        return new[]
        {
            new ActionGroup
            {
                Nodes = new()
                {
                    new ActionNode()
                }
            }
        };
    }
}

From there, you add the actions you want to have in the menu.

I hope this helps :)

- Jeppe

 
Andrejs Zavorotnijs
Reply

Hi Jeppe

That work fine for order list

But still cant find for orderlist single order and for order details page

And maybe you have some example, how I can use my custom function in this action nodes

 

You must be logged in to post in the forum