作成日: 2018/06/22 最終更新日: 2018/06/22
文書種別
使用方法
詳細
FlexGridのカスタムエディタにアクセスするには、OnClientBeginningEditプロパティでイベントを実装します。
また、イベント内でカスタムエディタのコントロールを取得するには、document.querySelectorメソッドを使用して引数を次のように指定します。
#[FlexGridのID]_Cell_r" + e.row + "_c" + e.col + "_[カスタムエディタコントロールのID]"
例えばFlexGridのIDが"grid"で、カスタムエディタとして設定したComboBoxコントロールのIDが"combo"である場合、document.querySelectorメソッドの引数は下記のようになります。
#grid_Cell_r" + e.row + "_c" + e.col + "_combo"
◎サンプルコード(View)
また、イベント内でカスタムエディタのコントロールを取得するには、document.querySelectorメソッドを使用して引数を次のように指定します。
#[FlexGridのID]_Cell_r" + e.row + "_c" + e.col + "_[カスタムエディタコントロールのID]"
例えばFlexGridのIDが"grid"で、カスタムエディタとして設定したComboBoxコントロールのIDが"combo"である場合、document.querySelectorメソッドの引数は下記のようになります。
#grid_Cell_r" + e.row + "_c" + e.col + "_combo"
◎サンプルコード(View)
<script id="editCountry" type="text/template">
@(Html.C1().ComboBox()
.Id("combo")
・・・
.ToTemplate())
</script>
<script>
function OnBeginEditting(s, e) {
if (s.columns[e.col].binding == "Country") {
setTimeout(function () {
let _el = document.querySelector("#grid_Cell_r" + e.row + "_c" + e.col + "_combo");
var _ctl = wijmo.Control.getControl(_el);
・・・
}, 50)
}
}
</script>
@(Html.C1().FlexGrid()
.Id("grid")
.Columns(c => {
・・・
c.Add(cb => cb.Binding("Country").CellTemplate(ctb=>ctb.EditTemplateId("editCountry")));
})
.OnClientBeginningEdit("OnBeginEditting")
)
@(Html.C1().ComboBox()
.Id("combo")
・・・
.ToTemplate())
</script>
<script>
function OnBeginEditting(s, e) {
if (s.columns[e.col].binding == "Country") {
setTimeout(function () {
let _el = document.querySelector("#grid_Cell_r" + e.row + "_c" + e.col + "_combo");
var _ctl = wijmo.Control.getControl(_el);
・・・
}, 50)
}
}
</script>
@(Html.C1().FlexGrid()
.Id("grid")
.Columns(c => {
・・・
c.Add(cb => cb.Binding("Country").CellTemplate(ctb=>ctb.EditTemplateId("editCountry")));
})
.OnClientBeginningEdit("OnBeginEditting")
)
旧文書番号
82964