Thread Rating:
  • 249 Vote(s) - 2.73 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sort of RecordView
11-21-2012, 02:23 PM,
#3
RE: Sort of RecordView
How about this?

Code:
{curl 7.0 applet}

{let people:RecordSet =
    {RecordSet
        {RecordFields
            {RecordField "First", domain = String},
            {RecordField "Last", domain = String},
            {RecordField "Age", domain = int},
            || hidden field
            {RecordField "hidden", domain = int}
        },
        || hidden = 0
        {RecordData First = "Gene", Last = "Smith", Age = 25, hidden = 0},
        {RecordData First = "Fred", Last = "Smith", Age = 29, hidden = 0},
        {RecordData First = "Mike", Last = "Jones", Age = 28, hidden = 0},
        {RecordData First = "Ben", Last = "Abrams", Age = 25, hidden = 0},
        {RecordData First = "Ben", Last = "Smith", Age = 21, hidden = 0},
        {RecordData First = "Sam", Last = "Jones", Age = 22, hidden = 0},
        {RecordData First = "Nigel", Last = "Stevens", Age = 24, hidden = 0},
        {RecordData First = "Bert", Last = "Stevens", Age = 22, hidden = 0},
        {RecordData First = "Pat", Last = "Linden", Age = 27, hidden = 0},
        || hidden = 1
        {RecordData First = "TOTAL", Last = "", Age = 25+29+28, hidden = 1}
    }
}
{let asc?:bool = true}
{let last-sort-column:String = ""}

{def rg = {RecordGrid
              record-source = people,
              height = 10cm,
              automatic-columns? = false,
              {RecordGridColumn "First"},
              {RecordGridColumn "Last"},
              {RecordGridColumn "Age"},

              sort = {RecordSort.from-string "hidden, Age"},
              sort-spec = {proc {rgc:RecordGridColumn}:RecordSort
                              {if last-sort-column != rgc.field-name then
                                  set asc? = true
                              }
                              let rs:RecordSort =
                                  {RecordSort.from-string
                                      "hidden " &
                                      {if asc? then
                                          "asc"
                                       else
                                          "desc"
                                      }
                                      & ", " & rgc.field-name
                                  }
                              || Store column name and sort order.
                              set last-sort-column = rgc.field-name
                              set asc? = not asc?
                              {return rs}
                          }
          }
}
{value rg}
Reply


Messages In This Thread
Sort of RecordView - by alchimiste - 11-21-2012, 10:23 AM
RE: Sort of RecordView - by fukuta - 11-21-2012, 02:04 PM
RE: Sort of RecordView - by alchimiste - 11-21-2012, 03:52 PM
RE: Sort of RecordView - by ashimo - 11-21-2012, 02:23 PM

Possibly Related Threads...
Thread Author Replies Views Last Post
  RecordView.batch-events? の効果がない umemura 1 2,666 12-10-2013, 03:28 PM
Last Post: umemura
Forum Jump:


Users browsing this thread:
1 Guest(s)

MyBB SQL Error

MyBB has experienced an internal SQL error and cannot continue.

SQL Error:
1017 - Can't find file: 'mybb_threadviews' (errno: 2)
Query:
INSERT INTO mybb_threadviews (tid) VALUES('652')