702 views
in GUI Development by
Hi everyone,

I have vertical list and a vertical list items with a delete button on them in my gui,

I want to develop a dynamic list with vertical list but i can not remove an item from the list.

Is it possible to remove an item?

Thanks in advance

1 Answer

0 votes
by

Hello,

as explained in the chapter Vertical List, the list itself does not manage any data. It does not store the data, so there is no functionality to add/remove, etc. the items. The list limit to display the item data from a separate data storage. When you scroll the list, for example, the list loads the exposed items from the storage by using the associated OnLoad slot method. With the implementation of the OnLoad method you provide the interface between the list and your particular data storage.

If you want an item to be removed or added, or you want to change the order of the items, you do this always in the data storage where your items are stored. This storage is an application specific aspect. If your application uses a data base, then your modification affects this data base. If your items are stored in an array, then you modify the content of this array. If your items are managed in a middleware, then you have to ask the middleware to modify the data.

Once you have modified the data storage, you notify the list about this alternation. If you have removed/added items from/to the list, also update the number of items the list actually presents. Thereupon the list will (if necessary) refresh its aspect automatically.

See also: Access list items and views.

Best regards

Paul Banach

by
As explained in the question above, in my case also I am using a dynamic vertical list. I am maintaining the data to be loaded in an array. I need to show / hide vertical list items from the requested position during runtime. Is it possible to handle this scenario with the vertical list without handling in the array.

because in array I can't change the size during runtime.
by
Hello Meenakshi Sundaram,

the list itself has no functionality to manage data, to hide items or show them again. It is entirely an aspect of the underlying data storage where the item information is available. So, yes, it is possible, but you have to take care of this data management.

In the simplest case, hiding an item would mean that the corresponding item's data is removed from the data storage (e.g. from the array). To show the item again, you add the data back to the storage. Also possible, instead of removing the data from the storage, you could manage for every item a 'hidden' flag. The OnLoadItem slot method should then evaluate the 'hidden' flag and skip over the corresponding items.

In other, more sophisticated case you could create an 'intermediate storage' between the original storage containing the data of all items and the list. This intermediate layer acts then like a filter. It exposes only the items which should be visible in the list.

I hope it helps you further.

Best regards

Paul Banach

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint

...