GridCore: add methods to HeaderPanel to add/remove toolbar items#33118
Open
anna-shakhova wants to merge 6 commits intoDevExpress:26_1from
Open
GridCore: add methods to HeaderPanel to add/remove toolbar items#33118anna-shakhova wants to merge 6 commits intoDevExpress:26_1from
anna-shakhova wants to merge 6 commits intoDevExpress:26_1from
Conversation
324e84d to
a88207d
Compare
a88207d to
e6e56e6
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a mechanism for dynamically managing GridCore header panel toolbar items by adding explicit addToolbarItem / removeToolbarItem APIs on HeaderPanel, and refactors the search panel integration to use these APIs (via a new controller) instead of extending HeaderPanel directly.
Changes:
- Added
HeaderPanel.addToolbarItem()/removeToolbarItem()with centralized sorting bysortIndex. - Refactored the search panel toolbar integration into
SearchPanelViewControllerthat registers/unregisters the search toolbar item on option changes. - Updated/added tests (QUnit + Jest integration) and adjusted related typing for toolbar items.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/devextreme/testing/tests/DevExpress.ui.widgets.dataGrid/keyboardNavigation.keyboardKeys.tests.js | Adjusts test setup ordering for searchPanel options before module initialization. |
| packages/devextreme/testing/tests/DevExpress.ui.widgets.dataGrid/headerPanel.tests.js | Switches tests to use this.option('searchPanel', ...) instead of mutating this.options.searchPanel. |
| packages/devextreme/testing/tests/DevExpress.ui.widgets.dataGrid/gridView.tests.js | Refactors one test’s grid creation/render flow; currently includes a stray debugger. |
| packages/devextreme/testing/tests/DevExpress.ui.widgets.dataGrid/dataGrid.tests.js | Removes an assertion that toolbar recomputation happens on searchPanel option changes. |
| packages/devextreme/js/__internal/grids/new/grid_core/toolbar/utils.ts | Formatting-only change to the types import. |
| packages/devextreme/js/__internal/grids/new/grid_core/toolbar/types.ts | Extends toolbar item typing with sortIndex and onItemRendered. |
| packages/devextreme/js/__internal/grids/grid_core/search/m_search.ts | Introduces SearchPanelViewController and registers/unregisters the search toolbar item dynamically. |
| packages/devextreme/js/__internal/grids/grid_core/search/tests/m_search.integration.test.ts | New Jest integration tests covering searchPanel runtime option changes without headerPanel invalidation. |
| packages/devextreme/js/__internal/grids/grid_core/m_types.ts | Adds searchPanel to the controllers typing map. |
| packages/devextreme/js/__internal/grids/grid_core/keyboard_navigation/m_keyboard_navigation.ts | Routes Ctrl+F focus behavior through the new searchPanel controller. |
| packages/devextreme/js/__internal/grids/grid_core/header_panel/m_header_panel.ts | Implements toolbar item registry + sorting, and wires onItemRendered passthrough. |
| packages/devextreme/js/__internal/grids/grid_core/header_panel/tests/m_header_panel.integration.test.ts | New Jest integration tests for the new headerPanel toolbar item registry APIs. |
| packages/devextreme/js/__internal/grids/grid_core/filter/m_filter_row.ts | Updates typing of headerPanel toolbar items to the shared ToolbarItem type. |
| packages/devextreme/js/__internal/grids/data_grid/export/m_export.ts | Removes local sort helper, relying on headerPanel’s centralized sorting. |
packages/devextreme/testing/tests/DevExpress.ui.widgets.dataGrid/gridView.tests.js
Outdated
Show resolved
Hide resolved
packages/devextreme/js/__internal/grids/new/grid_core/toolbar/types.ts
Outdated
Show resolved
Hide resolved
packages/devextreme/js/__internal/grids/grid_core/header_panel/m_header_panel.ts
Show resolved
Hide resolved
packages/devextreme/js/__internal/grids/grid_core/header_panel/m_header_panel.ts
Show resolved
Hide resolved
06979b3 to
39dc044
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
packages/devextreme/js/__internal/grids/grid_core/search/m_search.ts:165
SearchPanelViewController.optionChangedonly reacts tosearchPanel.textandsearchPanel.visible, but it marks allsearchPanel*changes as handled. This breaks common update paths likeoption('searchPanel', { visible: true, ... })(fullName === 'searchPanel') because the controller won't register/unregister the toolbar item, so the search panel never appears/disappears. It also prevents runtime updates toplaceholder/widthwhen visible. Consider handlingfullName === 'searchPanel'(and other relevantsearchPanel.*options) by updating/re-registering the toolbar item and/or updating the existing TextBox instance when already visible.
public optionChanged(args: OptionChanged): void {
if (args.name === 'searchPanel') {
if (args.fullName === 'searchPanel.text') {
const editor = this.getSearchTextEditor();
if (editor) {
editor.option('value', args.value);
}
}
if (args.fullName === 'searchPanel.visible') {
this._updateSearchPanelItem();
}
args.handled = true;
} else {
packages/devextreme/js/__internal/grids/grid_core/header_panel/m_header_panel.ts
Outdated
Show resolved
Hide resolved
f6f7cd9 to
a437a97
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.