Author Topic: ngui sortable table?  (Read 8275 times)

i_am_kisly

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 7
    • View Profile
ngui sortable table?
« on: May 03, 2015, 05:39:10 PM »
Hi! Does the implementation of ngui sortable table? Something similar to StringGrid Delphi.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: ngui sortable table?
« Reply #1 on: May 05, 2015, 09:58:26 PM »
I'm not sure what a "sortable" table would entail, so nope.

devomage

  • Sr. Member
  • ****
  • Thank You
  • -Given: 7
  • -Receive: 67
  • Posts: 250
    • View Profile
Re: ngui sortable table?
« Reply #2 on: May 06, 2015, 01:24:49 AM »
set your grid (or table) to "alphabetic".

prefab example:

- gameobject
   - label (id)
   - label (name)
   - label (color)

rename each root row (gameobject) to the "id", "name" or "color" value, then reposition the grid.

i_am_kisly

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 7
    • View Profile
Re: ngui sortable table?
« Reply #3 on: May 07, 2015, 01:29:08 PM »
All this is fine, but will not help if I want to sort the "name" or "color".

devomage

  • Sr. Member
  • ****
  • Thank You
  • -Given: 7
  • -Receive: 67
  • Posts: 250
    • View Profile
Re: ngui sortable table?
« Reply #4 on: May 07, 2015, 03:46:24 PM »
sure it will.

sort by "name":

- gameobject (transform.name = "orange")
   - label (id = 0)
   - label (name = "orange")
   - label (color = "orange")

- gameobject (transform.name = "apple")
   - label (id = 1)
   - label (name = "apple")
   - label (color = "red")

loop your list and rename the "transform.name" of the root to whatever you are sorting by.

sort by "color":

- gameobject (transform.name = "orange")
   - label (id = 0)
   - label (name = "orange")
   - label (color = "orange")

- gameobject (transform.name = "red")
   - label (id = 1)
   - label (name = "apple")
   - label (color = "red")


attached is a small demo example.  import into a new project.  also, import NGUI 3.8.2 (with NGUI examples, for atlases).
« Last Edit: May 07, 2015, 04:04:48 PM by devomage »