2012-08-02 69 views
0

刪除的項目我有一個問題...我試圖刪除從dijit.form.MultiSelect所選項目當我點擊按鈕,但不工作...道場從dijit.form.MultiSelect

這裏是代碼:

btnRemove = dijit.byId("btnRemove"); // button ID 
List= dijit.byId("List"); // ID List of items which I want    
          // to remove when click on someone item 
on(btnRemove , "click", function(evt){ // onClick event    
alert(dijit.byId("List").attr("value")); // returns a label of element 

// here must be a code to remove a selected item from MultiSelect - but don't work... 
List.containerNode.removeChild(dijit.byId("List").attr("value")); 

});

所有的代碼是在Javascript .. 感謝

+0

我想僅刪除選定的項目,當我點擊按鈕!謝謝 – user1562652 2012-08-02 07:41:10

回答

0

我解決了這個問題......如果有的話,將需要此:

,因爲我沒有找到dijit.form.MultiSelect有removeChild之選,我用另一個隱藏dijit.form.MultiSelect其中將項目從第一多選...

代碼是這樣的:

btnRemove = dijit.byId("btnRemove"); 
on(btnRemove, "click", function(evt){ 
dijit.byId("Removed").addSelected(dijit.byId("List"));  
}); 

其中Removed是隱藏的MultiSelect的ID,而List是可見的dijit.form.MultiSelect的ID