Thread Rating:
  • 291 Vote(s) - 2.84 Average
  • 1
  • 2
  • 3
  • 4
  • 5
レコードグリッドの行番号を表示するには?
08-21-2013, 01:31 PM,
#4
RE: レコードグリッドの行番号を表示するには?
RecordGridCell.record-index ですか!

format-spec を使うと、対象のRecordSetに存在する RecordField.field-name を指定しないと表示できない?のですかね?
対象のレコードに依存せずに、カラム単体で行番号を表示できるようにしたいです。
とりあえず、 refresh-data を利用してみました。

Code:
{define-class public LineNumberCell {inherits RecordGridCell }
  field line-number-frame:Frame = {Frame halign = "right", margin = 1pt}
  {constructor public {default ...}
    {construct-super {splice ...}}
    {self.add-internal self.line-number-frame}
  }
  {method public {refresh-data }:void
    {self.line-number-frame.add replace? = true, self.record-index + 1}
  }
}

{define-class public LineNumberColumnl {inherits RecordGridColumn}
  {constructor public {default
                          width:any = 20pt,
                          header-spec:any = "No.",
                          ...}
    {construct-super
        "",
        header-spec = header-spec,
        width = width,
        {splice ...}}
    set self.cell-spec = LineNumberCell
    set self.editable? = false
  }
}


{let people:RecordSet =
    {RecordSet
        {RecordFields
            {RecordField "First", domain = String},
            {RecordField "Last", domain = String},
            {RecordField "Age", domain = int}
        },
        {RecordData First = "John", Last = "Smith", Age = 25},
        {RecordData First = "Jane", Last = "Smith", Age = 29},
        {RecordData First = "Jane", Last = "Jones", Age = 28}
    }
}
{def rg =
    {RecordGrid
        {LineNumberColumnl},
        record-source = people,
        height = 5cm,
        width = 8in,
        vertical-grid-line-width = 4px
    }
}
{value rg}



Messages In This Thread
RE: レコードグリッドの行番号を表示するには? - by umemura - 08-21-2013, 01:31 PM
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('957')