B4J Question Sort TableView with objects

Discussion in 'B4J Questions' started by Radisk3, Aug 2, 2019.

Similar threads

B4J Tutorial TableView Tutorial
B4J Tutorial DBUtils Example
B4J Question TableView sort numbers
B4J Question TableView cell alignment and color
B4J Question TableView Sort
  1. Radisk3

    Radisk3 Member Licensed User

    Hi,

    I create my TableView with objects, according to the attached image.
    Is there any way to sort through the second column?
     

    Attached Files:

  2. emexes

    emexes Well-Known Member Licensed User

    This might do the job until a better answer arrives:

    upload_2019-8-2_22-42-42.png
     
  3. Radisk3

    Radisk3 Member Licensed User

    Hello!

    Thank you for your answer.
    I have tried the classification methods of the component, but without success.
    Understandable for being a grid of objects.
    I've thought of several ways to do it.
    For example:
    - Create a list, classify the list and fill the object grid with the classified list.
    - Create a tableview with the data, sort and then create tableview of objects with the classified grid.
    - Create a Tableview reading routine of objects to click on a tableview or listview variable, sort and recharge the tableview of objects.
    - ...
    In all these cases and others that I thought, I will always have to have an auxiliary table variable to classify when the user triggers the column title and recharges the grid.
    Since the grid is editable, it has to be more dynamic.

    So, if someone has already developed something similar or suggested another editable grid that accepts objects, such as buttons, it's viable.
     

    Attached Files:

  4. emexes

    emexes Well-Known Member Licensed User

    What are the objects?
    How does one sort buttons? By label text? By size? By X and then Y coordinates?
    Is each column a specific type, or does it vary from row to row?

    Given that TableView.Items is a regular List (of one array per TableView row) then it can probably be sorted in-place (sort of) (pun not intended)

    How many rows in table?
     
  5. Erel

    Erel Administrator Staff Member Licensed User

    (Use B4XTable instead of TableView it will let you customize the fields and they will be sortable)
     
    emexes likes this.
  6. Radisk3

    Radisk3 Member Licensed User

    Hey, guys!

    All right... the number of columns and rows is dynamic. It depends on the source data that are also variable.
    Therefore, the columns end up having different data types such as number, characters, dates.
    As for objects, at most I will need to place buttons and options.

    But Erel came up with an interesting idea... B4XTable.
    Since I am dealing with older projects, I had not realized the use of B4XTable for some processes and looking at the examples in the forum, I think I can adapt.
    I'll work on it today and check the results.
    Once finished, I will post the result here.

    Thank you emexes and Erel.
     
    emexes likes this.
  7. emexes

    emexes Well-Known Member Licensed User

    If those different types are within the one column, then I'm looking forward to seeing how you implement that. I can sort a list in-place on multiple columns, eg, by postcode, then age, then surname, but it relies on each column being just one field and type.
     
    Last edited: Aug 2, 2019
  8. Erel

    Erel Administrator Staff Member Licensed User

Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice