翻譯|使用教程|編輯:秦林|2022-11-10 09:28:03.613|閱讀 281 次
概述:本文給大家講解DHTMLX Gantt如何將父級(jí)控件添加到燈箱配置,歡迎大家下載最新版試用體驗(yàn)。
# 界面/圖表報(bào)表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關(guān)鏈接:
本文給大家講解DHTMLX Gantt如何將父級(jí)控件添加到燈箱配置,歡迎大家下載最新版試用體驗(yàn)。
用于更改任務(wù)父級(jí)的選擇框。該控件加載甘特圖中顯示的所有任務(wù),但您可以設(shè)置過濾規(guī)則和可顯示值的模板。其他一切都與Select Control相同。
gantt.config.lightbox.sections = [ {name:"description", height:38, map_to:"text", type:"textarea", focus:true}, {name:"parent", type:"parent", allow_root:"true", root_label:"No parent"}, {name:"time", height:72, type:"time", map_to:"auto"} ];
要將父級(jí)控件添加到燈箱,請(qǐng)執(zhí)行以下步驟:
1、在燈箱配置中添加一個(gè)部分:
gantt.config.lightbox.sections = [ {name:"description", height:38, map_to:"text", type:"textarea",focus:true}, {name:"type", type:"typeselect", map_to:"type"}, {name:"time", height:72, type:"duration", map_to:"auto"} ];
2、給部分設(shè)置標(biāo)簽:
gantt.locale.labels["section_parent"] = "Parent task";
以下屬性最重要且通常為父級(jí)控件設(shè)置:
name - (字符串) 部分名稱
高度- (數(shù)字)截面高度
map_to - ( string ) 將被映射到該部分的數(shù)據(jù)屬性的名稱
type - ( string )部分控件的類型
focus - ( boolean ) 如果設(shè)置為true,該部分將專注于打開燈箱
allow_root - ( boolean ) 如果設(shè)置為“true”,選項(xiàng)列表將包含一個(gè)附加選項(xiàng),允許用戶將根級(jí)別設(shè)置為任務(wù)的父級(jí)。與root_label屬性配對(duì)使用
root_label - ( string ) 為根級(jí)父級(jí)設(shè)置標(biāo)簽。與allow_root屬性配對(duì)使用
filter- ( function )為選擇選項(xiàng)設(shè)置過濾功能。以任務(wù)id和任務(wù)對(duì)象為參數(shù)
sort - ( function )為選擇選項(xiàng)設(shè)置排序函數(shù)
模板- (函數(shù)) 為選擇選項(xiàng)設(shè)置模板
要過濾父級(jí)控件中顯示的選項(xiàng),請(qǐng)使用filter屬性:
gantt.config.lightbox.sections = [ {name:"description", height:38, map_to:"text", type:"textarea", focus:true}, {name:"parent", type:"parent", filter:function(id, task){ if(task.$level > 1){ return false; }else{ return true; } }}, {name:"time", height:72, type:"time", map_to:"auto"} ];
filter屬性設(shè)置一個(gè)帶有 2 個(gè)參數(shù)的過濾函數(shù):
返回:
要對(duì)父控件中顯示的選項(xiàng)進(jìn)行排序,請(qǐng)使用sort屬性:
function sortByLength(a,b){ a = a.text.length(); b = b.text.length(); return a>b?1:(a<b?-1:0); }; gantt.config.lightbox.sections = [ {name:"description", height:38, map_to:"text", type:"textarea", focus:true}, {name:"parent", type:"parent", sort:sortByLength}, {name:"time", height:72, type:"time", map_to:"auto"} ];
sort屬性設(shè)置為每對(duì)相鄰值調(diào)用的排序函數(shù)并返回 1、-1 或 0 :
要在父級(jí)控件中設(shè)置選項(xiàng)模板,請(qǐng)使用模板屬性:
gantt.config.lightbox.sections = [ {name:"description", height:38, map_to:"text", type:"textarea", focus:true}, {name:"parent", type:"parent", template(start,end,ev){ var title = ev.id+"."+ev.text; return title; }}, {name:"time", height:72, type:"time", map_to:"auto"} ];
模板屬性設(shè)置了一個(gè)接受 3 個(gè)參數(shù)的函數(shù):
DHTMLX Gantt享有超十年聲譽(yù),支持跨瀏覽器和跨平臺(tái),性價(jià)比高,可滿足項(xiàng)目管理控件應(yīng)用的所有需求,是最完善的甘特圖圖表庫。慧都2022年終狂歡火熱進(jìn)行中,知名軟控件產(chǎn)品享超低折扣,滿額豪禮贈(zèng),復(fù)購雙重大禮!了解更多內(nèi)容,歡迎在線咨詢或者私信我獲取正版試用版及報(bào)價(jià)。
甘特圖控件交流群:764148812 歡迎進(jìn)群交流討論
慧都年終狂歡季,全場(chǎng)產(chǎn)品,限時(shí)特惠,立即了解詳情!
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請(qǐng)務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請(qǐng)郵件反饋至chenjj@fc6vip.cn