0
我想爲我的slickgrid中的一個專欄編寫自定義編輯器。理想情況下,此編輯器將包含另一個允許用戶篩選和選擇多個項目的slickgrid。是否可以在另一個slickgrid的編輯器中使用slickgrid?
- 有沒有人試過編寫一個包含另一個slickgrid實例的編輯器?
- 我應該避免有什麼問題嗎?
我想爲我的slickgrid中的一個專欄編寫自定義編輯器。理想情況下,此編輯器將包含另一個允許用戶篩選和選擇多個項目的slickgrid。是否可以在另一個slickgrid的編輯器中使用slickgrid?
我們剛剛完成了這個工作,我們在SlickGrid v1.4.3中發現的問題是,由於它們共享GlobalEditorLock狀態,所以遇到了兩個光滑網格的問題。換句話說,當你從彈出的光滑網格中選擇一個項目時,它會觸發你在原始網格中設置的處理程序的提交事件。這是困難。我們得到了解決此加入了一個名爲disableEditorCommit新選項默認爲false,並且改變源在handleClick方法:
if (options.enableCellNavigation && !columns[cell].unselectable) {
// if this is a popup then do not commit edits to the global editor
if (options.disableEditorCommit) {
scrollRowIntoView(row,false);
setSelectedCellAndRow($cell[0], (row === defaultGetLength()) || options.autoEdit);
} else {
// commit current edit before proceeding
if (validated === true || (validated === null && options.editorLock.commitCurrentEdit())) {
scrollRowIntoView(row,false);
setSelectedCellAndRow($cell[0], (row === defaultGetLength()) || options.autoEdit);
}
}
}
,並在handleDblClick方法:
validated = options.disableEditorCommit ? true : options.editorLock.commitCurrentEdit();
我們的彈出slickgrid有disableEditorCommit = true,所以它不會與我們在原始網格上設置的編輯器進行交互。