Thread Rating:
  • 306 Vote(s) - 2.72 Average
  • 1
  • 2
  • 3
  • 4
  • 5
同名RecordGridを何度も生成したときの挙動
10-22-2015, 06:15 PM,
#5
RE: 同名RecordGridを何度も生成したときの挙動
CurlドキュメントのRecordGridのcolumns (アクセサ)の説明をみると
「列グループを維持するには、代わりに RecordGrid.base-columns を使用します。」とあるので

・セット先をRecordGrid.columns →RecordGrid.base-columnsに変更、
・base-columns (アクセサ)の型が{Array-of BaseRecordGridColumn}なので、格納変数rgcの型も変更

とすれば、RecordGridColumnGroupもBaseRecordGridColumnを継承しているので指定できるように
なるかと思います。

こんな感じになるのでは

Code:
{curl 8.0 applet}

{def rg = {RecordGrid}}

{define-proc {set-columns-and-fields
                 rg:RecordGrid,
                 first-time?:bool = false
             }:void
    let fields:{Array-of RecordField} = {new {Array-of RecordField}}
    let rgc:{Array-of BaseRecordGridColumn} = {new {Array-of BaseRecordGridColumn}}
        
    {if first-time? then
        {rgc.append {RecordGridColumn "row-header"}}
        {rgc.append
            {RecordGridColumnGroup
                "group1",
                {RecordGridColumn "detail-amount-1"},
                {RecordGridColumn "detail-amount-2"},
                {RecordGridColumn "detail-amount-3"}
            }
        }
        
        {fields.append {RecordField "row-header", caption = "", domain = String}}
        {fields.append {RecordField "detail-amount-1",caption= "初回1"}}
        {fields.append {RecordField "detail-amount-2",caption= "初回2"}}
        {fields.append {RecordField "detail-amount-3",caption= "初回3"}}
     else
        {rgc.append {RecordGridColumn "row-header"}}
        {rgc.append
            {RecordGridColumnGroup
                "group1",
                {RecordGridColumn "detail-amount-1"},
                {RecordGridColumn "detail-amount-2"}
            }
        }
        {rgc.append
            {RecordGridColumnGroup
                "group2",
                {RecordGridColumn "detail-amount-3"},
                {RecordGridColumn "detail-amount-4"}
            }
        }
        
        {fields.append {RecordField "row-header", caption = "", domain = String}}
        {fields.append {RecordField "detail-amount-1",caption= "2回目1"}}
        {fields.append {RecordField "detail-amount-2",caption= "2回目2"}}
        {fields.append {RecordField "detail-amount-3",caption= "2回目3"}}
        {fields.append {RecordField "detail-amount-4",caption= "2回目4"}}
    }
    
    set rg.base-columns = rgc
    set rg.record-source = {RecordSet {RecordFields {splice fields}}}
}

{value
    {VBox
        rg,
        {CommandButton
            label = "1回目",
            {on Action do
                {set-columns-and-fields
                    rg,
                    first-time? = true
                }
            }
        },
        {CommandButton
            label = "2回目",
            {on Action do
                {set-columns-and-fields
                    rg,
                    first-time? = false
                }
            }
        }
    }
}


Messages In This Thread
RE: 同名RecordGridを何度も生成したときの挙動 - by dyoshida - 10-22-2015, 06:15 PM
Forum Jump:


Users browsing this thread:
3 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('1270')