Search Unity

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:
    372
    I don't see anything there that TablePro couldn't do..... BUT... it might just be best for you to create the functionality yourself in a more static UI. TablePro is best applied when you have large amounts of data or dynamic data and I don't believe that's the case here.
     
  2. jmdeb

    jmdeb

    Joined:
    Jul 28, 2017
    Posts:
    23
    Hello slumtrimpet!
    Table Pro seems to be exactly what I'm looking for!
    Just a couple of questions if you don't mind:
    - Is it possible to multi-select rows? I have to be able to select multiple rows with the help of the shift/ctrl key (contiguous/non contiguous selection) to mark them as hidden/visible
    - Is it be possible to have a secondary sort? If I choose to sort on 'Icon' (I'm here speaking here of your 'Population' example) I want of course to have the table sorted on 'icon'...but then on 'Rank' or 'Country'
    Thank you
     
  3. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    372
    Hello, thanks for your interest in TablePro!

    Yes, you can multi-select rows or cells. The four selection mode options on the table editor are:
    1. ROW: Select to enable full row selection
    2. CELL: Select to enable individual cell selection within a given row
    3. MULTIROW: select to enable shift+click selection of more than one row at a time
    4. MULTICELL: select to enable shift+click selection of more than one cell at a time
    Regarding sorting, TablePro's dataset acts and looks pretty much like a C# List. You are responsible for sorting it however you want when you populate the table but this allows you to definitely sort it however you want. :)

    Thanks
     
  4. jmdeb

    jmdeb

    Joined:
    Jul 28, 2017
    Posts:
    23
    Great (and thanks for the reply by the way!)
    Is it possible (or could it be easily achieved) to mimic the Windows behavior...which is to select one item, then keeping shift pressed and select - let's say - 20 rows below..and have all the rows between those two items selected?
     
  5. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    372
    We'll need to make this a new implementation editor setting since people are already using TablePro with the current functionality. I'll add it to our To Do list for future dev.
     
  6. Flag74

    Flag74

    Joined:
    May 31, 2017
    Posts:
    128
    Hi,
    My Camera/Canvas setup si breaking row/cell highlight somehow.
    To reproduce it:
    1)Open Simple scene
    2)Set Camera to Orthographic
    3)Move Camera to 0,0,0
    4)Set canvas to ScreenSpace-Camera
    5)Drag Camera to Canvas>RenderCamera
    6)Enable Canvas->PixelPerfect

    Can you check it please?
    thx
     
  7. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    372
    What version of Unity are you using? I tried in 2017.4.26f1 and it appears to be working fine with those settings.
     
  8. Flag74

    Flag74

    Joined:
    May 31, 2017
    Posts:
    128
    I'm on 2018.2.21f1
     
  9. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    372
    I am seeing the issue now in 2018.2.21. Can you please do me a favor and try to add "TABLE_PRO_DISABLE_VISIBILITY_TEST" to your Scripting Define Symbols in Player Settings? Let me know if that fixes things for you in both the sample and your actual scene.
     
  10. Flag74

    Flag74

    Joined:
    May 31, 2017
    Posts:
    128
    Yes, it fixes the issue in both example and in my project.
     
  11. Flag74

    Flag74

    Joined:
    May 31, 2017
    Posts:
    128
    @slumtrimpet if you r going to fix the issue on next patch, can I kindly ask you to add a callback when table refresh is done (when row datum assignment change) ? I really need it cause I need to call some methods in the same frame and I don't want to modify ur code.
    thank you
     
    Last edited: May 27, 2019
  12. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    372
    Sounds reasonable. This has been added to the list for the next release as well.
     
  13. fraeri

    fraeri

    Joined:
    Nov 8, 2018
    Posts:
    64
    Hi Slumtrimpet,
    wrote you an email, but no response so far.
    Let me ask my question here again.

    You provide the ability to but an image/sprite into one cell. But I need a couple of images in one cell side by side.
    I managed to "hack" into the table afterwards and do that, but scrolling is nearly impossible to handle. I guess you know why.

    See the screenshot below. I get the cell, add a horizontalLayoutGuide, deactivate the textGo and add the images I need. In my case the result is a horizontal bar chart. The solution is working as long as you don't (need to) scroll. After that it gets messy. I Need to detect what cell is on top and "redraw" every barchart.

    Do you have a better solution for what? One that came up to my mind is the deactivate the overflow function and create every row so you don't need to switch the cells data depending which one is the top.

    Thanks a lot
     

    Attached Files:

  14. Flag74

    Flag74

    Joined:
    May 31, 2017
    Posts:
    128
    I had the same problem and had to code a custom manager for that.
    Since number of Rows is fixed (due to performance reason), each row has a datum assigned based on what datum should be visible...that's why I asked for a callback firing when table refreshes (when datum<->row assignment changes)
    There's a Table method called GetRowForDatum() (@slumtrimpet that method would be faster using a Dictionary instead of iterating through all rows every time): detect when Row has a different Datum assigned (other than the one you stored inside your structure) and move (reparent) your Images in the right row/cell. You may also find Datum->rawObject useful.
    Honestly I don't know if there's a more elegant way to handle this.
    I agree that the author might add something to help us add custom gameobjects inside cells :) Maybe having a Transform reference stored inside each datum that gets reparented automatically to the Row assigned ?
     
  15. fraeri

    fraeri

    Joined:
    Nov 8, 2018
    Posts:
    64
    Yeah, that callback would help a lot. I don't have a problem iterating through the whole table, I have only 17 rows visible. Recreating the bars is not a big of a deal, but I don't like to check via update() if the first row is the real first row. That causes that the user can see the recreation of the bars.

    Do you got a code example for "reparenting" your GOs to the right cell? As I said atm I delete everything and create it again with the right assignments
     
  16. Flag74

    Flag74

    Joined:
    May 31, 2017
    Posts:
    128
    1)Create an empty gameobject called "ExtraImagesContainer"

    2)Create a class called "ExtraRow":
    Inside this class you will have those fields:
    Transform container;
    Datum curDatum;
    GameObjects[] MyExtraCellObjects (for each column in my case)

    3)Assign each instance of ExtraRow inside Datum->rawObject, filling curDatum with the current one and instantiate your extra images inside ExtraImagesContainer.

    Now when callback fires just iterate through your Datum->rawObjects (as ExtraRow) and get the right row using Table.GetRowForDatum(). At this point if row is null it means that your daum is offscreen and put it back inside container, otherwise reparent to the row/cell obtained.
     
  17. Flag74

    Flag74

    Joined:
    May 31, 2017
    Posts:
    128
    Also while you wait for the new version of the plugin you have to add your eventhandler inside OnBodyScroll() in Control.cs
     
  18. fraeri

    fraeri

    Joined:
    Nov 8, 2018
    Posts:
    64
    Oh I see what you are doing! Quite elegant solution! Thank you so much for the suggestion! I need to implement that, but first I will wait for the reply of @slumtrimpet. My solution is working for now ;)
     
    Flag74 likes this.
  19. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    372
    @fraeri @Flag74

    Sorry I've been out of the loop traveling. I'm back on the case now and will look to incorporate some of what you both are discussing here to make it easier from my end.
     
  20. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    372
    I'm submitting release 1.31 shortly. It should include a fix that will support your screen canvas setup without you needing the precompiler definition.
     
  21. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    372
    This will also be included in release 1.31. See page 17 of the docs for a basic summary of the callback signature.
     
  22. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    372
    This will be included in release 1.31. You need to set up the table selection handler in a specific way for this to activate.

    Under General Settings in the editor, you'll select "MULTIROW" or "MULTICELL" for the Table Selection UI Mode value. Next, un-check Always Multi Select. Finally, select "CONTROL" as your Multi Select Key.

    TablePro should then mimic Windows functionality where Ctrl+click adds or removes from the current selection set while Shift+click will select the rows/cells between your previous click target and the current click target.
     
  23. Flag74

    Flag74

    Joined:
    May 31, 2017
    Posts:
    128
    Hi, one last thing.
    Could you please include the PointerEventData on row selection callback? At the moment I can't know if the row has been selected by click or by code.
    thank you (do you know any workaround btw?)
     
  24. fraeri

    fraeri

    Joined:
    Nov 8, 2018
    Posts:
    64
    Hi Slumtrimpet, what do you say about my "issue"? Could I fix it with release 1.31 by using the "rowDatumChangeHandler"-Callback for triggering my method for reassigning?

    Sorry, but how do I Use it exactly?

     
    Last edited: Jun 13, 2019
  25. Flag74

    Flag74

    Joined:
    May 31, 2017
    Posts:
    128
    Code (CSharp):
    1. table.rowDatumChangeHandler += onDatumChanged;
    2. private void onDatumChanged(Row obj)
    3. {
    4. }
     
    fraeri likes this.
  26. fraeri

    fraeri

    Joined:
    Nov 8, 2018
    Posts:
    64
    Worked perfectly for me! I'm wondering why I didn't used actions before ... that one was new for me :) I'm happy with that.

    Also, I would like to Pick up the "Sorting"-functionality. I saw it in the Documentary in the example on Page One.
    Is there a build in functionality for that or do I have to build that by myself? It's not written there.


    EDIT: Well, ok found it. Its in the DataTable Example ;)
     
    Last edited: Jun 16, 2019
  27. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    372
    What if we added a bool that is true/false if it's a user or programmatic selection we are firing on. I want to be sure I'm understanding though, is that the entire gap we are trying to close right now or do you need the actual PointerEventData for positioning or other fun?
     
  28. Flag74

    Flag74

    Joined:
    May 31, 2017
    Posts:
    128
    a boolean is ok. I just need to know if it was the user to click on the row or the selection have been set by code.
     
  29. Allthebees

    Allthebees

    Joined:
    Apr 22, 2017
    Posts:
    18
    Hi there,

    What determines cell width and height?

    I want to restrict to 100% width max, and also have equal heights and widths for all cells but there doesn't seem to be an intuitive way to do this. Right now it seems like the cell width is defined by the width that the header data takes up, and I'm not sure what determines the cell height...

    If restrict to 100% width max is not turned on, things are fine, but obviously there is the overflow off the screen (which is then disabled from drawing for optimisation), so not ideal.
     
  30. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    372
    The table is all auto-sized vertically based on content. I'm not sure if our engine would work very well for you if you just want all the cells to be uniform squares. You might be best off rolling a grid layout controller on top of the standard LayoutGroup Unity widget instead of using TablePro for that application. If that negates the usefulness of TablePro for you, please PM me and we'll hook up a refund.
     
  31. Allthebees

    Allthebees

    Joined:
    Apr 22, 2017
    Posts:
    18
    TablePro is working well for me. I've figured out a sort of work-around as I dug through a bit more and it'd be tricky to deviate from the auto-sizing implemented, so no worries :)

    As far as I can tell, OnInputFieldChange fires before the the datum is updated. Is there a design reason behind this?

    Thanks for the help so far!
     
  32. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    372
    It's a good question...

    I can't honestly recall why we wrote it like this at this point, but much like all several-year-old code... I'd be fearful to change it now and break other implementations.

    The callback does indeed pass the 'original' datum before it's updated.

    Code (CSharp):
    1.  
    2. this.cell.column.inputChangeCallback(this.cell.row.datum,
    3.   this.cell.column,
    4.   this.cell.element.value,
    5.   this.inputField.text);
    6. this.cell.element.value = this.inputField.text;
    Looking at this now, I feel we went way overboard with what's passed to that callback as you basically have two snapshots of the 'before' data, one of the 'after' data, and the column... but this is how it is. :)
     
  33. KAYUMIY

    KAYUMIY

    Joined:
    Nov 12, 2015
    Posts:
    115
    Hello,

    Before I am going to buy your asset, I have to make a sure that your asset has features that I need.

    Can I ask some questions?

    1. Is it possible to modify or change color of cell in run time by using your asset "Table - Pro"? like the picture below attached file.

    2. Is it possible to filter column? like "show me elements which have this 'value'?"

    3. Sorting table from this date to this date?


    Thank You Sir.

    Regards,
    Kayumiy
     

    Attached Files:

  34. Allthebees

    Allthebees

    Joined:
    Apr 22, 2017
    Posts:
    18
    Haha, yep, if it works don't fix it ;)

    I'm almost finishing up with the project I'm using this fantastic plugin for, so hopefully this is my last question!

    When dealing with very large spreadsheets performance can take a big hit. Loading between these spreadsheets can take 1000s of ms. Is there something I might be doing wrong, for example clearing the table, then adding the new data could be really inefficient and you have a better way of handling these situations?

    Cheers :)
     
  35. KAYUMIY

    KAYUMIY

    Joined:
    Nov 12, 2015
    Posts:
    115
    Data coming from XML file should be displayed in the Scene during run time. is It possible to show XML data in the scene by using this asset?
    I cannot make it...
     
  36. KAYUMIY

    KAYUMIY

    Joined:
    Nov 12, 2015
    Posts:
    115
    Is it possible to modify or change the color of cell in run time by using "Table Pro"? like the picture below.
     

    Attached Files:

  37. KAYUMIY

    KAYUMIY

    Joined:
    Nov 12, 2015
    Posts:
    115
    Is it possible to increase the size of the Spinner Sprite?
     
  38. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    372
    TablePro just shows lists of data so any sorting and filtering can be implemented, but it's your responsibility to do that and then populate TablePro with your result.

    Each individual cell element can have a unique color by setting it's 'backgroundColor' attribute.
     
    KAYUMIY likes this.
  39. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    372
    You can assign a value to the spinner sprite, but the size is fixed.
     
    KAYUMIY likes this.
  40. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    372
    You need to populate the TablePro data like any normal C# List. Your root data can come from XML or JSON or anywhere you wish.
     
    KAYUMIY likes this.
  41. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    372
    How large is "very large" here? One weakness we have is when spreadsheets have many columns. We handle many thousand rows with no issue, but 100's of columns become problematic.
     
  42. KAYUMIY

    KAYUMIY

    Joined:
    Nov 12, 2015
    Posts:
    115
    Sir

    I am going to access Text component and Image component of the each cell in order to change the color and check the string value of the cell.

    Can you help me to do this?

    You explained data structure in your documentation. but I cannot understand data structure of TablePro very well.
    Is there any other documentation explaining in detail?
     
  43. Allthebees

    Allthebees

    Joined:
    Apr 22, 2017
    Posts:
    18
    11 columns, and 300 rows is the largest I'm using to test so not too large - Since I've updated some of my functionality, I've noticed an improvement so I suspect it's likely to do with how I convert between TableDatumList and my own storage solution.

    I have found a bug: MoveSelectionUp and MoveSelectionDown can both break the functionality of the table. They in theory have wrap around, but it causes issues. MoveSelectionDown does have wrap around, i.e. it will take you back to the top of the table, where MoveSelectionUp does not, you stay the bottom of the table.

    The thing is, both of them, on attempted wrap around (the point where they should wrap around) break the use of the table - the scroll bar gets confused (different outcomes, sometimes it just vanishes, other times it will start scrolling uncontrollably etc.) This can also sometimes lead to not being able to select any cells (but rows are sometimes still selectable). I haven't really been able to document exactly all the effects of this bug because not all the effects occur every time.

    Resetting the table does nothing, only full restart of the programme fixes the issue.

    I've fixed the issue for myself by just preventing MoveSelectionUp if at the first Datum of the table and preventing MoveSelectionDown if at the last Datum of the table, but I understand you might want to fix the underlying issue to allow for wrap around navigation.


    This is an example method to define the color of a cell based on the integer value inside of it:

    Code (CSharp):
    1.     private void SetCellColor(Datum d, int column)
    2.     {
    3.         Color col = ColorList[0];
    4.         int num = 0;
    5.         bool success = Int32.TryParse(d.elements[column].value, out num);
    6.         if(Mathf.Abs(num) < ColorList.Length) col = ColorList[Mathf.Abs(num)];
    7.  
    8.         d.elements[column].backgroundColor = col;
    9.     }
    Hope this helps :)
     
  44. KAYUMIY

    KAYUMIY

    Joined:
    Nov 12, 2015
    Posts:
    115
    Dear Sir

    Is it possible to add a filter button to each cell. Filter button is designed to filter the data such as searching by value or sorting ...like the picture below
     

    Attached Files:

  45. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    372
    Thanks for the bug report! We'll check it out and get it patched up (or remove the event from firing when on first/last rows like you did).
     
  46. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    372
    If you look at the various Table.Initialize methods, there is an argument passed to them called 'hasHeaderIcon'. If you set this to
    Code (CSharp):
    1. true
    you can then set each Column object's headerIcon attribute to whatever sprite you wish.

    Access the Column objects via the
    Code (CSharp):
    1. table.columns
    list.

    If you want to adjust the size of the header icon sprites, they are definable in the header properties in the editor.
     
    KAYUMIY likes this.
  47. Allthebees

    Allthebees

    Joined:
    Apr 22, 2017
    Posts:
    18
    No worries, been using this plugin a lot over the past few days :p

    I've found another bug:

    OnScrollerValueChanged(float f) in the ScrollWatcher class prevents inputField cells from being used at all when the size of the window is too large by constantly de-focusing them as soon as they are selected.
     
  48. KAYUMIY

    KAYUMIY

    Joined:
    Nov 12, 2015
    Posts:
    115
    How to add toggle to each row?
    I need to make a toggle column which is having a only toggles in the table.
     

    Attached Files:

  49. KAYUMIY

    KAYUMIY

    Joined:
    Nov 12, 2015
    Posts:
    115
    how to add a sprite to each cell in the table?
     
  50. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    372
    Have you looked at the included samples? The "kitchen sink" example shows how to add sprites to cells. If you want to implement a 'toggle' effect, you would need two sprites: One representing "ON" and another "OFF". You would then change the sprite associated with the cell when the click event happens.