Thread Rating:
  • 317 Vote(s) - 2.83 Average
  • 1
  • 2
  • 3
  • 4
  • 5
RecordGrid指定列のドラッグ不可
06-04-2014, 06:19 PM,
#4
RE: RecordGrid指定列のドラッグ不可
抜け道がありそうですが・・・。

Code:
||先頭でポジションを保持するカラム
{define-class public CustomRecordGridColumn {inherits RecordGridColumn}
  field public position-fix?:bool
  {constructor public {default
                          position-fix?:bool = false,
                          ...
                      }
    set self.position-fix? = position-fix?
    {construct-super {splice ...}}
  }
}

||CustomRecordGridColumn に位置を保持させるグリッド
{define-class public CustomRecordGrid {inherits RecordGrid}
  {constructor public {default
                          ...
                      }
    {construct-super {splice ...}}
  }

  {method public {move-column
                     source-index:int,
                     destination-index:int
                 }:void
    ||移動先のカラムが CustomRecordGridColumn.position-fix?=true なら
    ||カラムの移動自体をキャンセルする
    {if destination-index < self.columns.size - 1 then
        {type-switch self.columns[destination-index]
         case crgc:CustomRecordGridColumn do
            {if crgc.position-fix? then {return }}
        }
    }
    {super.move-column source-index, destination-index}
  }
}

{let rec_set:RecordSet=
    {RecordSet
        {RecordFields
            {RecordField "id"   ,domain = int,caption="ID"}
            ,{RecordField "name"   ,domain = String,caption="名前"}
            ,{RecordField "age"   ,domain = String,caption="年齢"}
            ,{RecordField "sex"   ,domain = String,caption="性別"}
        }
        ,{RecordData id=1,name="一郎",age="20才",sex="男"}
        ,{RecordData id=2,name="花子",age="18才",sex="女"}
        ,{RecordData id=3,name="次郎",age="16才",sex="男"}
        ,{RecordData id=4,name="良子",age="14才",sex="女"}
        ,{RecordData id=5,name="三郎",age="12才",sex="男"}
    }
}

{let RG:CustomRecordGrid=
    {CustomRecordGrid
        record-source=rec_set,
        {CustomRecordGridColumn
            "id",
            column-movable? = false,
            column-resizable?  = false
            ,position-fix? = true
        }
    }
}
{RG.set-frozen-region 0,1}
{value RG}


Messages In This Thread
RecordGrid指定列のドラッグ不可 - by rom - 06-02-2014, 06:14 PM
RE: RecordGrid指定列のドラッグ不可 - by umemura - 06-04-2014, 06:19 PM
Forum Jump:


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