Skip to content

Commit

Permalink
grid.Container: columns_: add support for run-time changes #6217
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiu committed Jan 14, 2025
1 parent f2d3b08 commit 1083111
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 32 deletions.
2 changes: 2 additions & 0 deletions src/container/Base.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,8 @@ class Container extends Component {
itemsRoot.cn.push(vdom)
});

// We need to add items into the vdom
me.updateDepth = -1;
me.update()
}

Expand Down
4 changes: 2 additions & 2 deletions src/grid/Container.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ class GridContainer extends BaseContainer {
* @protected
*/
afterSetColumns(value, oldValue) {
if (Array.isArray(oldValue) && oldValue.length > 0) {
if (oldValue?.length > 0) {
let me = this,
{headerToolbar} = me;

Expand All @@ -231,7 +231,7 @@ class GridContainer extends BaseContainer {
headerToolbar.createItems()
}

me.view?.createViewData(me.store.items)
me.view?.createViewData()
}
}

Expand Down
32 changes: 2 additions & 30 deletions src/grid/header/Toolbar.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,7 @@ class Toolbar extends BaseToolbar {

super.createItems();

let dockLeftWidth = 0,
dockRightWidth = 0,
{items} = me,
len = items.length,
let {items} = me,
style;

items.forEach((item, index) => {
Expand All @@ -128,31 +125,8 @@ class Toolbar extends BaseToolbar {
if (item.minWidth) {style.minWidth = item.minWidth + 'px'}
if (item.width) {style.width = item.width + 'px'}

if (item.dock) {
NeoArray.add(item.vdom.cls, 'neo-locked');

/*if (item.dock === 'left') {
style.left = dockLeftWidth + 'px'
}
dockLeftWidth += (item.width + 1) // todo: borders fix
*/
}

item.sortable = me.sortable;
item.wrapperStyle = style;

// inverse loop direction
item = items[len - index -1];

/*if (item.dock === 'right') {
style = item.wrapperStyle;
style.right = dockRightWidth + 'px';
item.wrapperStyle = style;
dockRightWidth += (item.width + 1) // todo: borders fix
}*/
item.wrapperStyle = style
});

me.update()
Expand All @@ -172,8 +146,6 @@ class Toolbar extends BaseToolbar {
return null
}



/**
* @param {Boolean} silent=false
* @returns {Promise<void>}
Expand Down

0 comments on commit 1083111

Please sign in to comment.