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:
    338
    Set the cell's (aka a SLS.Widgets.Table.Element object in TablePro speak) 'backgroundColor' property.
     
  2. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    338
    Each cell you create has a creation method with signature:

    Code (CSharp):
    1. public Column AddTextColumn(string header=null, string footer=null, float minWidth=-1, float maxWidth=-1)
    You can set the minWidth and maxWidth, but you cannot set the hight. That's always derived from the cell contents and various padding properties you can adjust on the table editor.
     
  3. astorms

    astorms

    Joined:
    Jan 31, 2018
    Posts:
    26
    Thanks so much! That was extremely helpful.
     
  4. astorms

    astorms

    Joined:
    Jan 31, 2018
    Posts:
    26
    Hi @slumtrimpet

    I am having 2 very noticeable issues with the table that I am hoping you can help with:

    1) the header text is not vertically aligned properly using TextMeshPro as shown in the attached image (Description and Interval columns are the most noticeable). What really surprises me is I checked the rect transforms of the Header Column gameobjects and their child text objects in play mode and all had identical values (aside from X position and width). Even the TextMeshPro components were identical.
    2) Some of the row lines are darker than others. and it's not the same ones all the time, it varies during scrolling

    EDIT: issue 2 is not as big of a deal - turning off the lines helped a lot. issue 1 is what I'm really concerned about.

    Thanks in advanced!
     

    Attached Files:

    Last edited: Oct 5, 2018
  5. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    338
    For #2, you need to make your horizontal lines > 1px or set your canvas to pixel perfect, that's not really a TablePro issue but a Unity issue.

    This will be included in the next release, but in the meantime, the fix for #1 is:

     
    Last edited: Oct 10, 2018
  6. astorms

    astorms

    Joined:
    Jan 31, 2018
    Posts:
    26
    Thank you for getting back to me. The fix for #1 did fix the vertical alignment of the column headers, but introduced a new issue in the table body when a row has multiline text:
    upload_2018-10-12_14-46-41.png

    Thanks!
     
  7. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    338

    Freaking disaster man... sorry, I should have tested better.

    Try this:

     
  8. astorms

    astorms

    Joined:
    Jan 31, 2018
    Posts:
    26
    Thank you so much for the quick response - that did the trick!
     
  9. Fab-London

    Fab-London

    Joined:
    Feb 6, 2013
    Posts:
    16
    Did we find a solution to the re-sizing performance issue? I am having the same problem.

    Thanks
    Fabien

     
  10. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    338
    We are looking at it... so far it's required pulling the Unity UI source code and changing a silly behavior in their OnRectTransformDimensionsChanged event. We are hoping to find a less intrusive fix though... sorry for the delay but this one is a tough issue. We are on it though.
     
  11. p00temkin

    p00temkin

    Joined:
    Aug 12, 2017
    Posts:
    2
    Ended up adding this in Cell.cs, SetColor():

    string cellValue = this.text.text;
    if (cellValue != null) {
    if (cellValue.Equals("triggervalue")) {
    this.background.color = new Color(156 / 256f, 76 / 256f, 76 / 256f, 0.4f); // red
    return;
    }
    }
     
  12. Fab-London

    Fab-London

    Joined:
    Feb 6, 2013
    Posts:
    16
    Thanks, let us know
     
  13. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    338
    Well... not necessarily good news, but we found some fixes around whether or not your UI canvas is set to pixel-perfect or not. There honestly is just a lot of 'stuff' around handling resize. Probably best to disable the table game-object then re-initialize and re-enable it after resize... but I'll PM you a link to the latest test asset bundle to see if it helps at all.
     
  14. Berno

    Berno

    Joined:
    Oct 29, 2014
    Posts:
    15
    Hello,
    I need to programmatically control the view of the table.
    So I can scroll to the required row with SetSelected and animate set to true.
    However what I need is when the selected Row is not on the first page of data is to have this selected Row in the middle of the table view as much as possible.
    If I could know how many rows are visible I could use half that amount as buffer either side of the required row. I had thought that I’d seen GetRowForDatum returning null as implying the row isn’t visible however it seems to continue off screen for a number of extra rows.
    Do you have any other methods of achieving this I haven’t spotted in the code?
     
  15. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    338
    Not really, no. We have a patch to address extra rows being created but that probably won't help you fill this request either way. You'd probably need to resort to measuring the size of the table scroller frame and the row and adjusting the scrolling until it's positioned the way you want it, but we don't support that natively.
     
  16. Robotron18

    Robotron18

    Joined:
    Aug 15, 2010
    Posts:
    12
    Hello, dear friends.

    - Columns can contain either Text (with InputField's optionally supported) or Sprite elements.

    I'd like to use the Button elements into rows table. Can I take it in Tables Pro asset?
     
  17. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    338
    No. You can capture any click events on rows or columns so can react to clicks similar to button elements, but we don't support using the 'real' Unity.UI Button.
     
  18. AndreasO

    AndreasO

    Joined:
    Sep 25, 2012
    Posts:
    90
    Hi, I just purchased this asset and have quite a lot of questions now after trying it out.

    Is there a way to customize the look & feel of the table except just colors?

    What I mean is like using a specific texture for the scrollbar track and handle.
    I would also like to disable "inertia" and "swiping" on the table (in the ScrollRect component to be exact).

    Would I have to do these kind of changes with a custom script at run-time?

    I also wonder why there is a gap between the header bar and the vertical scrollbar. I suppose this is where scroll bar up/down buttons would fit in nicely. But why aren't they visible? Is there a method to set this up?

    The example code in step four in the documentation on your website is outdated.
    http://semi-legitimate.com/tablepro/basicUsage.html
    It is still using some older API.
    Not a show stopper for me as nothing seems to have really changed in the end.
     
  19. jammingames

    jammingames

    Joined:
    Nov 17, 2013
    Posts:
    8
    Hi,
    I'm currently helping out on a project using this asset and we're having a massive performance issue from garbage collection. I was hoping to refactor it to use an object pool instead of instantiate/destroy but it looks like all the cells are created using go = new GameObject() and then components are added to them. Is there any chance of an update that uses an object pool in the near future? or some advice on refactoring it? Typically my object pool method requires a prefab or a class to pass to the pool so I'm not sure the best method forward at refactoring your Factory.cs to work that way.
     
  20. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    338
    We currently just support color customization.

    You can access the scroller and customize attributes via:
    table.bodyScroller

    I know what you mean on the body scrollbar spacing. That's actually just the UI layout currently and there are no hidden buttons you are missing.
     
  21. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    338
    Are you sure you are seeing destroy events? We only ever create a specific amount of gameobjects that are needed to fill the screen and we re-use those rows/cells. We don't destroy objects or continuously instantiate rows.

    Are you seeing the same behavior in the demo scenes?
     
  22. jammingames

    jammingames

    Joined:
    Nov 17, 2013
    Posts:
    8
    Ah okay upon further looking into it it's the way the previous coder has implemented some stuff, he's recreating tables unneccesarily instead of just keeping one and editing it. It wasn't code in your end it was on ours. The plugin itself works great!
     
  23. mzatopek_misterine

    mzatopek_misterine

    Joined:
    Oct 24, 2018
    Posts:
    2
    Hello,
    I have found an issue while trying out your component. I am using Unity 2018.3.0b11, and I know that it is a beta version and there might be issues, but when I am trying your sample scenes I am experiencing quite a heavy flickering during scrolling. If there is an issue in the beta version of unity it would be nice to report it, but I have no idea what can be the cause.
     
  24. Porzellan_Legionaer

    Porzellan_Legionaer

    Joined:
    Feb 6, 2018
    Posts:
    2
    Im not the dev, but from what i can see the flickering is caused by all cells getting inactive/invisible while scrolling. This reduces render calls and hides the object-pooling when the top or last cell is moved to the oposite end.
    If u scroll very slow u can see that the cells only hide if on row leaves the view.
     
  25. mzatopek_misterine

    mzatopek_misterine

    Joined:
    Oct 24, 2018
    Posts:
    2
    Thank you for your reply. I get it now. The flickering is visible only when iOS build setting is selected. So it is related to the known issue 1064796 I guess.
     
  26. annahofseth

    annahofseth

    Joined:
    Mar 16, 2018
    Posts:
    3
    Hi! I'm having an issue with the table being stuck "loading". It doesn't stop loading until I resize the table rectTransfrom. Is there a way of force-refreshing the table?
     
  27. ade76

    ade76

    Joined:
    Apr 9, 2014
    Posts:
    19
    Hi

    Quick question before I purchase this. Is it possible to add a table pro table into a scrollview that already has content so doesnt add its own scroll bars?

    So i do not end up with a scrollable table in an existing scrollview.

    I.e the table pro doesnt setup its own scrollview but honours the one its already contaiend wtihin?
     
  28. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    338
    Sounds like you are missing a step in the init calls. Do the samples work for you? Look at the sample code and double-check to make sure you are implementing the init method in the same way.
     
  29. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    338
    Table-Pro just lives inside a root RectTransform and creates scrollbars for its content when necessary. If you make the RectTransform sufficiently large and control scrolling externally then it should work fine.
     
  30. gavin002

    gavin002

    Joined:
    Mar 9, 2018
    Posts:
    2
    can any one help me~~
    in my pc,the table gameobject alpha equal to zero when table dragging
    (see the gif in attachment)
    ---------------------------------------------------------------------------------------
    i see the Documentation ,it work well when table dragging
    but in my pc, it seem not normal,

    the package version is "current ver. 1.25"
    the unity version is "Unity 2018.3.0f2 (64-bit)"
    the pc is "window 10"
    use the simple scene of package(no any change)

    although I can hide the relevant code
    (see the png in attachment , the Row.cs, "public void Refresh()" function)
    but i don't understand why??
    i don't understand why there is such a problem.
     

    Attached Files:

  31. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    338
    Yuck... ugly bug there. A temporary workaround is to set the animation speed to 0. This will let you at least scroll but won't show the 'normal' animation when table data changes. I'll look at it and see if I can find a better solution.

     
  32. gavin002

    gavin002

    Joined:
    Mar 9, 2018
    Posts:
    2
    OK,thank your help
     
  33. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    338
    @gavin002 : Just submitted build 1.28 to the Asset Store for approval. Once that pushes through, your screen refresh troubles should be over.
     
    Last edited: Jan 31, 2019
  34. fraeri

    fraeri

    Joined:
    Nov 8, 2018
    Posts:
    31
    Hi @slumtrimpet,
    i have a problem with the asset. With Unity 2018.3.(I did not test older versions, because I bought the asset a few days ago) tables are not shown in the final build. Not even the examples that came with it. In the Editor everything is fine, but in my final Mac or Windows builds I can't see anything.

    Do you know why?
     
  35. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    338
    Ewww.... no, I haven't seen that behavior yet but I'll check today.
     
  36. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    338
    I rolled a Windows build from 2018.3.2f1 of the DataTable.unity scene included in the Samples directory and it's working for me. Can you give me any more info or PM me a reproducible test scene I can poke at?

     
  37. fraeri

    fraeri

    Joined:
    Nov 8, 2018
    Posts:
    31
    Hi, I wrote you a PM. With the Steps I did and uploaded the project I used.
    My view btw and the Log file
     

    Attached Files:

    Last edited: Feb 2, 2019
  38. danielcoren

    danielcoren

    Joined:
    Jan 24, 2019
    Posts:
    1
    I have the same problem, on win & android. i check it also with the simple scriept. it works perfect on the editor.
     
  39. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    338
    Yeah, I worked through this in PM's with @fraeri. Sorry, should have put the synopsis back over here. TMPro used to create a TMP_PRESENT Scripting Define Symbol. What we found is that it, evidently, no longer does that.

    Short term, go ahead and add TMP_PRESENT to Scripting Define Symbols yourself. (assuming you have TextMeshPro enabled, which you should since it's free now)



    Long Term, I need to look at how TMPro announces it's presence in the current release.
     
    Last edited: Feb 7, 2019
  40. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    338
    Per this forum post per @Stephan_B, it looks like we are stuck waiting on Unity to come up with a more slick way to note when TextMeshPro is present.

    Until Unity makes a better solution for this our best bet is to manually add the TMP_PRESENT Scripting Define Symbol to tell TablePro to use it.
     
  41. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    338
    One more followup on on this... if for some insane reason you don't want to use TextMeshPro (you should...), there's another fix for this issue to get TablePro working with legacy Unity Text.

    At about line 54 in Factory.cs, change the material creation to this (adding the fallback to use UI/Default shader as that seems to be the valid name in current release):

    Code (CSharp):
    1. #if !TMP_PRESENT
    2.       if (this.table.fontMaterial == null) {
    3.         Shader s = Shader.Find("UI/Default Font");
    4.         if (s == null) s = Shader.Find("UI/Default");
    5.         this.table.fontMaterial = new Material(s);
    6.       }
    7. #endif
     
  42. Edward1970

    Edward1970

    Joined:
    Feb 6, 2019
    Posts:
    2
    Hello dear friend.
    I inserted support for custom sprites to the scroll bar. Now I need to expand the size of the scroll bar to the size of the body zone. Like this:

    http://prntscr.com/mjhjuv

    Where in the code can I fix these indents? Thanks.
     
  43. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    338


    This will be included by default in the next release.
     
  44. Edward1970

    Edward1970

    Joined:
    Feb 6, 2019
    Posts:
    2
    Thank you.

    I want to draw your attention to one recurring error in the code. This method in Table.cs:
    Code (CSharp):
    1.     public void SetBodyRectSizeLater(float s1, float s2) {
    2.       StopCoroutine("DoSetBodyRectSizeLater");
    3.       StartCoroutine(this.DoSetBodyRectSizeLater(s1, s2));
    4.     }
    The coroutine DoSetBodyRectSizeLater will not be stopped. https://docs.unity3d.com/ScriptReference/MonoBehaviour.StopCoroutine.html
    You have to use this method:
    Code (CSharp):
    1.     private IEnumerator BodyRectSizeLateCoroutine;
    2.     public void SetBodyRectSizeLater(float s1, float s2) {
    3.       if (BodyRectSizeLateCoroutine != null) StopCoroutine(BodyRectSizeLateCoroutine);
    4.       BodyRectSizeLateCoroutine = DoSetBodyRectSizeLater(s1, s2);
    5.       StartCoroutine(this.BodyRectSizeLateCoroutine);
    6.     }
     
  45. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    338
    Holy... crap...

    You're right... I have a lot of refactoring to do right now in both TablePro and a bunch of other things. Thanks for pointing this out though... no idea how I've never hit this before.
     
  46. KnuckleCracker

    KnuckleCracker

    Joined:
    Dec 27, 2011
    Posts:
    63
    When adding a table to a canvas that has Render Mode set to "Screen Space - Camera", I get some bizarre results when scrolling the table. The table repeats values, or draws blank rows, etc. To work around it, I have to fiddle with the Y coordinate of the camera that is used for rendering. Leaving the UI camera I use set to 0,0,0 produces the odd results. Setting it to 0,50,0 makes the table work properly.

    I suspect it has something to do with ui measurements that the table performs. That's getting goofed up when the containing canvas is set to screen space camera. I'm using Unity 2018.2.20f1. My UI camera is orthographic (not sure that matters).
     
  47. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    338
    Seems to work for me on 2018.3.5, but I'll pull 2018.2.20 and test in the exact rev you are using. I'll report back in a bit.

    EDIT: also... if you can reproduce the issue in one of the included TablePro sample scenes, that would help a ton. PM me if you can do that and could shoot over the scene.
     
  48. slumtrimpet

    slumtrimpet

    Joined:
    Mar 18, 2014
    Posts:
    338
    I guess I'm going to have to ask if you can help me with a reproducible scene. I can't get the behavior you describe in 2018.2.20 in the sample scenes no matter how I set the camera or the canvas render mode. What's are your canvas scaler settings?
     
  49. KnuckleCracker

    KnuckleCracker

    Joined:
    Dec 27, 2011
    Posts:
    63
    I've sent you PM with a project that reproduces it. I had to set the canvas to pixel perfect. I reproduced it with one of the sample scenes (after changing the canvas camera settings, of course). If you don't see the conversation/PM with the project let me know.
     
  50. daven8989

    daven8989

    Joined:
    Jan 25, 2014
    Posts:
    26