Search Unity

  1. Get the latest news, tutorials and offers directly to your inbox with our newsletters. Sign up now.
    Dismiss Notice

Table Pro: When Your Data isn't a Game

Discussion in 'Assets and Asset Store' started by slumtrimpet, Aug 15, 2015.

  1. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    359
    Very sorry for the delayed response here... the sorting is based 100% on the order in which you populate the Datum 'list' object. The rows will be displayed in the same order.
     
  2. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    359
    Very sorry for the delayed response here... I tried to duplicate this behavior in the "Simple" sample screen included with the project. It seems to work ok for me with just one row and the 100% width setting. I don't see that you are doing anything wrong or different but I of course can't see everything. Can you look at the "Simple" sample scene and check for anything you are doing differently?
     
  3. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    359
    Are you using TMPRO text or Unity? I'd recommend using TMPRO and make sure you aren't manipulating the font properties anywhere else in your project. It sounds like a shared asset issue.
     
  4. skytow2003

    skytow2003

    Joined:
    Feb 9, 2014
    Posts:
    29
    I am using TMPRO Ugui. I had some problems with using same font with both unity text and tmpro. Will check into that. Thanks
     
  5. capgunmatt

    capgunmatt

    Joined:
    Feb 29, 2020
    Posts:
    7
    I've implemented sorting by editing the datastructure I give to the table.data, so I will implement filtering the same way, but I wonder if
    1) sorting is done in the asset already, but I can't see it in this forum or the docs, and again
    2) whether filtering will be added to the asset, or if the assumption is that we handle our own data structures being passed to the table?

    Thanks
     
  6. capgunmatt

    capgunmatt

    Joined:
    Feb 29, 2020
    Posts:
    7
    That reply was 6 years ago, so I thought I'd ask again. Is resizeable columns going to be supported?

    Cheers
     
  7. SocialFreak

    SocialFreak

    Joined:
    Dec 12, 2015
    Posts:
    37
    I'm sure this is listed somewhere here but I just can't find it!

    When I click on a row, regardless of the column, I want to be able to get the data in the first cell of the selected row. How can I go about accomplishing this?

    Thanks!
     
  8. SpyGuy

    SpyGuy

    Joined:
    Apr 12, 2015
    Posts:
    6
    Hello i want to give size according to my wish to each column. and if size of all columns is greater than parent container slider should appear. can you please help me out.
     
  9. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    359

    If you initialize your table with:

    Code (CSharp):
    1.       this.table.Initialize(this.OnTableSelected);
    Then the OnTableSelected handler could be something like the following to accomplish your goal:

    Code (CSharp):
    1.     private void OnTableSelected(Datum datum) {
    2.       if(datum != null)
    3.         print("You Clicked: " + datum.uid + " First Cell: " + datum.elements[0].value);
    4.       else
    5.         print("Selection Cleared!");
    6.     }
     
  10. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    359
    Initialize your columns with the optional minWidth argument:

    Code (CSharp):
    1.       this.table.ResetTable();
    2.  
    3.       this.table.AddTextColumn("Column1", minWidth:400);
    4.       this.table.AddTextColumn("Column2", minWidth:400);
    5.       this.table.AddTextColumn("Column3", minWidth:400);
    6.  
    7.       this.table.Initialize(this.OnTableSelected);
    Then in the table editor, under "General Settings", check the "Force 100% Width Min" option.
     
  11. ProgrammingWhileSleeping

    ProgrammingWhileSleeping

    Joined:
    Nov 10, 2017
    Posts:
    17
    Hi, @slumtrimpet I'm having trouble with our tables. We have 2 tables for user banning and un-banning. We sometimes get an unnecessary horizontal scrollbar at the bottom. How it happens is, if I first open user banning, when I open un-banning, the scrollbar appears there. This happens as well if I open the un-banning menu and then open the banning menu so the banning menu gets the scrollbar. Any suggestions or is this a currently known bug? Thanks!
     
  12. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    359
    Is this anything you could PM me a test project that reproduces the issue? I've not seen this behaviour.
     
  13. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,294
    I'm currently looking for a decent table renderer ... and this looks super-promising. A few quick questions (I'm primarily a software-engineer, so if I need to do some coding to achieve what I want, that's fine):
    1. Can I add selection ranges, i.e. select rows 3-8? I'd probably have two modes, one where players select one row, and if they select another one, that replaces the selection; and one where players can drag-select (replacing the drag-scroll feature), and then, clicking on the first or last selected row would unselect, and clicking on the first unselected row next to the selection would expand the selection; clicking on a row that is not connected to the selection would create a new selection. I think I only need row-selections ... maybe also column selections ... and selecting individual cells.
    2. Can I have non-uniform rows? In particular, what I need are different line-widths for the rows, like first a stronger line, then three thin lines, then a medium line, another three thin lines, and so forth.
     
  14. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    359
    Regarding #1, yeah we support multi-select on entire rows or cells/rows. Its selectable from within the widget editor when you drop a table in your scene.

    For #2... the rows are adaptive to the height of their content so it is possible to have them be different heights but you can't just explicitly say "row 2 == 200 height" and "row 3 == 100 height" as it's all controlled by magic under the covers. This one is a tough call on if we'd be able to fill the need you have here or not.
     
    jashan likes this.
  15. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,294
    Cool, thank you for the quick reply. Regarding #2, I was actually thinking of the lines between the rows. We actually need the row-height to be uniform but I believe that should automatically be the case when we control the contents of each row.

    I guess the question is basically: Can we control the width of the lines between the rows somehow? If this means I have to hack in some logic into your line-rendering code, that's not problem as long as the code doesn't heavily rely on all lines being the same width (which may very well be).

    Basically, what I'm trying to achieve is something like this:

    upload_2020-10-16_18-21-6.png
     
  16. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    359
    I'd love to give you a different answer, but I'd say it's probably going to be problematic. It's definitely not something that's supported in the base lib and I spent a bit of time thinking through a hack to implement what you describe and I'm afraid it probably won't be a good solution.
     
    jashan likes this.
  17. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,294
    Ok, thank you anyways, for thinking it through, I really appreciate that. It turns out that I'm probably best off rolling my own solution for this. Like, I realized that one thing I need is also being able to have elements "off-grid", i.e. a little above or below a given cell. Plus, I don't need any of the usual input-handling of tables ... but I certainly have your package bookmarked for when I need a more classic table solution ;-)
     
    slumtrimpet likes this.
  18. drew55

    drew55

    Joined:
    Dec 13, 2017
    Posts:
    42
    Hi @slumtrimpet -- I'm trying to figure out why a table that get Datum updates when it's disables (I verify the data going in) doesn't refresh when the table is enabled. Is there an explicit call to trigger an update?
    Thanks,
    Drew
     
  19. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    359
    There is some magic in coroutines that takes care of the table update stuff. If you disable/reenable a table you need to at least call
    Code (CSharp):
    1. table.StartRenderEngine();
    .

    Depending on the exact usage in your application, you might want to go through the full initialization flow on re-enable:

    Code (CSharp):
    1.  
    2.       this.table.ResetTable();
    3.  
    4.       this.table.AddTextColumn("Column1", minWidth:400);
    5.       this.table.AddTextColumn("Column2", minWidth:400);
    6.       this.table.AddTextColumn("Column3", minWidth:400);
    7.  
    8.       this.table.Initialize(this.OnTableSelected);
    9.  
    10.        //  add data
    11.    
    12.       this.table.StartRenderEngine();
    13.  
     
  20. drew55

    drew55

    Joined:
    Dec 13, 2017
    Posts:
    42
    Wonderful, thanks for the quick reply.
     
  21. dc-Trevellyon

    dc-Trevellyon

    Joined:
    Feb 9, 2021
    Posts:
    4
    whats the best way to get a LEFT shift select of rows highlighted with a list of rows
    i know you have multirow select as you have mentioned that
    we are currently doing something similar to
    Code (CSharp):
    1. private void OnTableSelected(Datum datum, Column column)
    2.         {
    3.             if (Input.GetKey(KeyCode.LeftShift))
    4.             {
    5.                 Debug.Log("Left Shift key is being pressed");
    6.                 if (!leftClickStarted)
    7.                 {
    8.                     leftClickStarted = true;
    9.                     datatableRowStartIndex = int.Parse(datum.uid);
    10.                 }
    11.                 else
    12.                 {
    13.                     datatableRowFinishIndex = int.Parse(datum.uid);
    14.                 }
    15.             }
    16.             else
    17.             {
    18.                 if (leftClickStarted)
    19.                 {
    20.                                    getfinish row
    21.                                     do stuff with these rows
    22.                                  }
    23.                 }
    24. }
    25.  
    its a bit ugly i was wondering how to utlise the multi select or if possible the left shift click stat and finish..
     
  22. dc-Trevellyon

    dc-Trevellyon

    Joined:
    Feb 9, 2021
    Posts:
    4
    Found the solution its simple set the Table Selection UI Mode to MultiRow and the MultiSelect Key to Control
    then call this simple function
    Code (CSharp):
    1.  
    2. List<Datum> dds = table.GetSelectedDatumList();
    3. foreach (Datum dd in dds)
    4. {
    5.     string ThirdCellvalue = table.data[int.Parse(dd.uid)].elements[3].value;
    6.      // do some more code  here
    7. }
    8.  
    actually quite simple although this was not mentioned in teh documentation that i could find but managed to find it in the intillisense and had a play..
     
    Last edited: Feb 10, 2021
  23. airpass

    airpass

    Joined:
    Sep 7, 2020
    Posts:
    1
    Hi, thanks for good asset. How can I resize table by rows,colums?
    I tried Adding Component 'Content Size Fitter' but nothing changed.
     
unityunity