作成日: 2021/01/21 最終更新日: 2021/01/21
文書種別
使用方法
詳細
直接的な機能は用意されておりませんが、下記のような関数を実装することで対応できます。
◎サンプルコード(View)
◎サンプルコード(View)
<script>
function collapseAll(ctrl){
var headers = ctrl.hostElement.querySelectorAll(".wj-header");
for (var i = 0; i < headers.length; i++) {
if (headers[i].className.indexOf("wj-state-active") > -1) {
headers[i].click();
}
}
}
function expandAll(ctrl) {
var headers = ctrl.hostElement.querySelectorAll(".wj-header");
for (var i = 0; i < headers.length; i++) {
if (headers[i].className.indexOf("wj-state-active") == -1) {
headers[i].click();
}
}
}
function expandAt(ctrl, index) {
var headers = ctrl.hostElement.querySelectorAll(".wj-header");
if (headers[index].className.indexOf("wj-state-active") == -1) {
headers[index].click();
}
}
function collapseAt(ctrl, index) {
var headers = ctrl.hostElement.querySelectorAll(".wj-header");
if (headers[index].className.indexOf("wj-state-active") > -1) {
headers[index].click();
}
}
</script>
<button id="collapseAll">Collapse All </button>
<button id="expandAll">Expand All </button>
<button id="expandAt">Expand At 1</button>
<button id="collapseAt">Collapse At 1</button>
@Html.C1().Accordion("#mvcAccordion").AllowCollapseAll(true).AllowExpandMany(true)
<script>
function elem(id) {
return document.getElementById(id);
}
c1.documentReady(function () {
var _ctl = wijmo.Control.getControl("#mvcAccordion");
elem("collapseAll").addEventListener("click",collapseAll.bind(this,_ctl));
elem("expandAll").addEventListener("click",expandAll.bind(this,_ctl));
elem("expandAt").addEventListener("click",expandAt.bind(this,_ctl, 1));
elem("collapseAt").addEventListener("click",collapseAt.bind(this,_ctl, 1));
});
</script>
function collapseAll(ctrl){
var headers = ctrl.hostElement.querySelectorAll(".wj-header");
for (var i = 0; i < headers.length; i++) {
if (headers[i].className.indexOf("wj-state-active") > -1) {
headers[i].click();
}
}
}
function expandAll(ctrl) {
var headers = ctrl.hostElement.querySelectorAll(".wj-header");
for (var i = 0; i < headers.length; i++) {
if (headers[i].className.indexOf("wj-state-active") == -1) {
headers[i].click();
}
}
}
function expandAt(ctrl, index) {
var headers = ctrl.hostElement.querySelectorAll(".wj-header");
if (headers[index].className.indexOf("wj-state-active") == -1) {
headers[index].click();
}
}
function collapseAt(ctrl, index) {
var headers = ctrl.hostElement.querySelectorAll(".wj-header");
if (headers[index].className.indexOf("wj-state-active") > -1) {
headers[index].click();
}
}
</script>
<button id="collapseAll">Collapse All </button>
<button id="expandAll">Expand All </button>
<button id="expandAt">Expand At 1</button>
<button id="collapseAt">Collapse At 1</button>
@Html.C1().Accordion("#mvcAccordion").AllowCollapseAll(true).AllowExpandMany(true)
<script>
function elem(id) {
return document.getElementById(id);
}
c1.documentReady(function () {
var _ctl = wijmo.Control.getControl("#mvcAccordion");
elem("collapseAll").addEventListener("click",collapseAll.bind(this,_ctl));
elem("expandAll").addEventListener("click",expandAll.bind(this,_ctl));
elem("expandAt").addEventListener("click",expandAt.bind(this,_ctl, 1));
elem("collapseAt").addEventListener("click",collapseAt.bind(this,_ctl, 1));
});
</script>
旧文書番号
86348