0 Favourites

Best way to create a data grid / table?

  • hi guys,

    trying to create a data grid - type table in C2 and was wondering if anyone had already done this or could point me in the right direction.

    i'm creating a multiplayer game with a "game lobby", with a long table of data fetched from a database to display 100+ rows of "open games" that users can join.

    i have all the database functions completed and working, i can test load data using the text objects, but I will need a solution for a future of 100+ rows.

    what is the best way to display rows of data in C2?

  • I usually make a function that reads the data from an array with loopindex-ed position.

    Or you can use the board plugin:

  • rainmaker, I once programmed a solution like this, using text objects as well!

    What you do is, instead of creating 10000000 text objects for a big table, create only as many as the user can see at once, then add a scrollbar to the side.

    When the user scrolls, instead of scrolling the layout as you would do normally, just make the source text for each line advance by one.

    Say your source data is a list of fruits:

    [1] - Banana

    [2] - Apple

    [3] - Orange

    [4] - Watermelon

    [5] - Pineapple

    [6] - Grape

    [7] - Blueberry

    And the user can see 3 lines at most

    Line 1 -> fruits[1]

    Line 2 -> fruits[2]

    Line 3 -> fruits[3]

    Now say the user scrolls 1 item down. Instead of seeing "Line 4", the lines themselves don't change, just the references:

    Line 1 -> fruits[2]

    Line 2 -> fruits[3]

    Line 3 -> fruits[4]

    This way, the objects remain fixed, nothing new is created, just their text is changed! The only downside is the scrolling appears less smooth, since you can't scroll down, say, "10 pixels. You must scroll in whole lines.

  • rainmaker, I once programmed a solution like this, using text objects as well!

    What you do is, instead of creating 10000000 text objects for a big table, create only as many as the user can see at once, then add a scrollbar to the side.

    When the user scrolls, instead of scrolling the layout as you would do normally, just make the source text for each line advance by one.

    Say your source data is a list of fruits:

    [1] - Banana

    [2] - Apple

    [3] - Orange

    [4] - Watermelon

    [5] - Pineapple

    [6] - Grape

    [7] - Blueberry

    And the user can see 3 lines at most

    Line 1 -> fruits[1]

    Line 2 -> fruits[2]

    Line 3 -> fruits[3]

    Now say the user scrolls 1 item down. Instead of seeing "Line 4", the lines themselves don't change, just the references:

    Line 1 -> fruits[2]

    Line 2 -> fruits[3]

    Line 3 -> fruits[4]

    This way, the objects remain fixed, nothing new is created, just their text is changed! The only downside is the scrolling appears less smooth, since you can't scroll down, say, "10 pixels. You must scroll in whole lines.

    I like your solution, thanks for share

  • rainmaker, I once programmed a solution like this, using text objects as well!

    What you do is, instead of creating 10000000 text objects for a big table, create only as many as the user can see at once, then add a scrollbar to the side.

    When the user scrolls, instead of scrolling the layout as you would do normally, just make the source text for each line advance by one.

    Say your source data is a list of fruits:

    [1] - Banana

    [2] - Apple

    [3] - Orange

    [4] - Watermelon

    [5] - Pineapple

    [6] - Grape

    [7] - Blueberry

    And the user can see 3 lines at most

    Line 1 -> fruits[1]

    Line 2 -> fruits[2]

    Line 3 -> fruits[3]

    Now say the user scrolls 1 item down. Instead of seeing "Line 4", the lines themselves don't change, just the references:

    Line 1 -> fruits[2]

    Line 2 -> fruits[3]

    Line 3 -> fruits[4]

    This way, the objects remain fixed, nothing new is created, just their text is changed! The only downside is the scrolling appears less smooth, since you can't scroll down, say, "10 pixels. You must scroll in whole lines.

    Awesome!! I figured it would be something like that. Thanks a lot!

  • rainmaker, the iScroll plugin can do this -- its a pretty rich HTML formatted scrollable table to!

    Downside, the author doesn't have time to fix any issues you may find, however, it's worth checking out.

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • rainmaker, the iScroll plugin can do this -- its a pretty rich HTML formatted scrollable table to!

    Downside, the author doesn't have time to fix any issues you may find, however, it's worth checking out.

    Awesome, I'm going to test this plugin

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)