create empty groups, and add elements in event

create empty groups, and add elements in event


I am binding a class that contains a list, this list is empty and I want to fill it so that the groups appear but only when I fire the GroupExpanding event.


So, the listview starts grouped, when the user expands it should fill the list for that group only.



6 Replies

BA BagavathiPerumal Apranandham Syncfusion Team July 22, 2022 02:04 PM UTC

Hi Sergio Ayala,



We are validating your reported query. We will validate and update you in two business days. We appreciate your patience until then.



Regards,
Bagavathi Perumal A



GT Gokul Thanudhas Syncfusion Team July 27, 2022 02:41 PM UTC

Hi Sergio,


We have created a simple based on your requirement. In this sample we maintain two collection
  1. A full list of items. (CountryInfoCollection)
  2. An ObservableCollection which holds only items that are currently visible.
As you expand a group, required items will be copied from CountryInfoCollection list to the ObservableCollection.


For your reference, kindly refer to the sample


Regards,

Gokul T.


Attachment: SfListView_dfde8531.zip



SA Sergio Ayala replied to Gokul Thanudhas July 29, 2022 04:21 AM UTC

the example you give me does not correspond to the one proposed by me, you already have the lists filled when you create the classes. I need the list to be filled when the row is ungrouped ()



GT Gokul Thanudhas Syncfusion Team July 29, 2022 02:14 PM UTC

Hi Sergio,


We have maintained two collections in the provided

  1. One contains the full list which is not used as datasource.
  2. Another contains limited items that are shown in the SfListView (which is assigned as datasource)


As the group is expanded, items from the full list is added to the limited list based on the expanded group.


If we misunderstood your query, please provide more information about your query. So that we can prompt the solution further.


Regards,

Gokul T.




SA Sergio Ayala July 29, 2022 05:07 PM UTC

I have NOT explained myself well, you have the lists filled in the constructor and then you use them to fill the control. I need the lists to be filled with data during the event and not in the constructor, because the child elements are searched according to the selected group.



BA BagavathiPerumal Apranandham Syncfusion Team August 2, 2022 05:28 AM UTC

Hi Sergio Ayala,


If no data is added, SfListView will be empty. There needs to be one item per group so that we can expand it, hence one item per group in the constructor. When a group is expanded, we are adding an item that belongs to that group.

Please debug and check what data is maintained in both
collections.  If you are still unclear, please create a support ticket for further assistance.


Regards,

Bagavathi Perumal A


Loader.
Up arrow icon