Android Question PreoptimizedCLV and CLVExpandable

Sergey_New

Well-Known Member
Licensed User
Longtime User
Couldn't find any example of sharing.:mad:
I'm wondering how to change the height of the expandable row for any CLV entry.
 

TILogistic

Expert
Licensed User
Longtime User
?
 
Upvote 0

Sergey_New

Well-Known Member
Licensed User
Longtime User
oparra, thanks for the link!
Alas, loading 1000 records takes more than 5 seconds. This option doesn't work for me.
With PreoptimizedCLV, loading times are short, and there is no way to set the height of expandable rows.
 
Upvote 0

Sergey_New

Well-Known Member
Licensed User
Longtime User
Mahares, I am attaching the project.
Loading 10,000 records is fast, but I need to set a different ExpandedHeight depending on the parent row.
 

Attachments

  • B4J_ExpandableList.zip
    6 KB · Views: 94
Upvote 0

Mahares

Expert
Licensed User
Longtime User
but I need to set a different ExpandedHeight depending on the parent row.
Are you saying you want to display items under any given panel when expanded, then auto close it when another panel is clicked. See image below. If that is the case I can upload a B4J project to illustrate that to give you ideas for your real project, using Lazy Loading in xCLV ( not PCLV which not essential as Erel said). If you are thinking differently, then wait till someone else tackles your problem.

1642460774012.png
 
Upvote 0

Sergey_New

Well-Known Member
Licensed User
Longtime User
Are you saying you want to display items under any given panel when expanded, then auto close it when another panel is clicked.
Yes, but the time for 10000 entries should be comparable to my example.

I do not understand what you want to say
I want that in my example, for each record, it would be possible to display several elements in height in the drop-down field (for example, Label). Their number depends on the parent row.
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
I want that in my example, for each record, it would be possible to display several elements in height in the drop-down field
I have created a B4J project based on yours with 10000 records and takes 10 ms to load all. It has PCLV and lazy loading. I also added a list of items where each list item is loaded onto a label to make the child views for each panel clicked. I am using the same list for each record. When you click a panel title, the pane expands and displays the 11 items in the list. See screenshot. It needs some tweaking. Other than that it works. If you want to play with it, I can post it. If not, good luck.

1642517998428.png
 
Last edited:
Upvote 0

Mahares

Expert
Licensed User
Longtime User
Of course I want! Publish please!
Here it is. I hope it helps some. If you improve it, which you certainly will, share the code with the rest. If it does not help, just toss it. If you ask and I do not answer, then it means I have no answer and someone else may possibly help.
 

Attachments

  • B4J_ExpandableListModifiedByMaharesPCLVAndLL.zip
    7.5 KB · Views: 99
Upvote 0

Sergey_New

Well-Known Member
Licensed User
Longtime User
Maharis, thank you so much!
An example is almost what I needed. I explain:
Imagine that Item #1, Item #2, and so on, are the owners of the animals on your list. Each of them may be different. One has only a dog, another has a cat, the third has everything. So I want to see what animals each owner has?
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
Maharis, thank you so much!
An example is almost what I needed. I explain:
Imagine that Item #1, Item #2, and so on, are the owners of the animals on your list. Each of them may be different. One has only a dog, another has a cat, the third has everything. So I want to see what animals each owner has?
Just somethink real quick. Of course to do it the proper way is to have a database table that you extract the distinct owners and use a query to select each owner's animals from another query. Requires a little work on your part.
B4X:
Private DataMain As List  'in globals , use DataMain instead of Data
Change thie below line from
B4X:
 Data.AddAll(Array As String("Dog", "Cat", "Giraffe", "Bird", "Lion", "Hippopotamus", "Camel", "Tiger", "Elephant" _
    , "Gazelle", "Cheetah"))
To:
B4X:
 DataMain.AddAll(Array As String("Dog", "Cat", "Giraffe", "Bird", "Lion", "Hippopotamus", "Camel", "Tiger", "Elephant" _
    , "Gazelle", "Cheetah"))

Add these few lines to the top of Private Sub clv1_VisibleRangeC
B4X:
 Private Sub clv1_VisibleRangeChanged (FirstIndex As Int, LastIndex As Int)
   Dim Data As List
    Data.Initialize
    Dim x As Int = Rnd(0, DataMain.Size)   'use a different number of animals for every title.

    For k=x To DataMain.Size-1
        Data.Add(DataMain.Get(k))
    Next
 
Upvote 0

Sergey_New

Well-Known Member
Licensed User
Longtime User
Maharis, unfortunately, the height of the expanded panel does not change according to the number of animals.

1.png
 
Upvote 0

TILogistic

Expert
Licensed User
Longtime User
Maharis, unfortunately, the height of the expanded panel does not change according to the number of animals.
see:
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
Well @oparra clarified it for you. If you are really serious about building an app that uses xCLV with CLVExpandable, lazy loading and do all you want done with it, you really need a bonafide database that has all the necessary columns to make it work, not just having data coming from: For i=0 to 10000. You are not going to give it justice by using a 0 to 10000 loop that is very abstract.
 
Upvote 0
Top