Unplanned
Last Updated: 01 Mar 2023 15:36 by ADMIN
Nathan
Created on: 16 Feb 2023 07:01
Category: Toolbar
Type: Feature Request
1
Toolbar AddItem to add the dataItem to its options.items

Good Day,

I believe it would be useful to update the `add` method to include the added items data Object, as you need to provide one to add it in the first place, to the options.items array in the widget itself. It would be consistent with the design of the widget in the first place and can allow dynamic code to iterate over newly added items without catering for specific bespoke IDs

 

Thankyou for your time,

Regards

Nathan

3 comments
ADMIN
Georgi Denchev
Posted on: 01 Mar 2023 15:36

Hi, Nathan,

Thank you for the clarification. Updating the options of a component is not a good practice as they are meant to represent the initial state.

However, I do agree that exposing a field that holds all of the current items sounds like a good idea. I'll approve the request and I'll sync it with the dev working on the ToolBar once they come back to work.

Best Regards,
Georgi Denchev
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Nathan
Posted on: 22 Feb 2023 23:10

Good Day, Georgi,

The desired outcome is not for the function to return the data itself, however when adding the dataItem to the widget, it would be ideal for it to be saved into its options property: menu.options.items.

Currently this is how we are adding new items at runtime

var buttonConfig = {
id: uid,
type: 'button',
//text: iconSpan,
encoded: false,
cssClass: "details-panel-menu-button float-menu-right",
spriteCssClass: icon,
click: function(e){
inTouch.Tooltips.CloseAll();
functionToCall.call();
}
};
menu.add(buttonConfig);
menu.options.items.push(buttonConfig);

This is because when you simply add the dataItem, it is not stored inside the widget itself, it simply creates the element and moves on. It makes sense that when you give it a dataItem to create the element, it should save the dataItem.

Regards,
Nathan

 

ADMIN
Georgi Denchev
Posted on: 22 Feb 2023 14:51

Hello, Nathan,

I just want to make sure I understand the request correctly. When the `add` method is invoked, it should return an array of all items currently in the Toolbar, is that correct?

let allItems = grid.add({
        type: "button",
        text: "Just added",
        togglable: true
    });

Best Regards,
Georgi Denchev
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.