-
-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: revert to old behavior but properly generate picker labels #1606
Conversation
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1606 +/- ##
========================================
- Coverage 99.8% 99.8% -0.0%
========================================
Files 198 198
Lines 21795 21794 -1
Branches 7303 7159 -144
========================================
- Hits 21734 21733 -1
+ Misses 61 55 -6
- Partials 0 6 +6 ☔ View full report in Codecov by Sentry. |
@@ -593,8 +593,7 @@ export class SlickGrid<TData = any, C extends Column<TData> = Column<TData>, O e | |||
if (emptyTarget) { | |||
emptyElement(target); | |||
} | |||
const node = options?.cloneNode ? val.cloneNode(true) : val; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you also remove the options prop above cloneNode?: boolean;
since it's no longer needed
if (column?.name instanceof HTMLElement || column?.name instanceof DocumentFragment) { | ||
return column.name.textContent ?? ''; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so I had a very similar approach but I think it would be better to go with mine instead, because with yours, you forgot to deal with the line 280. So I think it's better to first extract the column name for all other usage as shown below
function pickerHeaderColumnValueExtractor(column: Column, gridOptions?: GridOption) { | |
let colName = column?.name ?? ''; | |
if (colName instanceof HTMLElement || colName instanceof DocumentFragment) { | |
colName = colName.textContent || ''; | |
} | |
const headerGroup = column?.columnGroup || ''; | |
const columnGroupSeparator = gridOptions?.columnGroupSeparator ?? ' - '; | |
if (headerGroup) { | |
return headerGroup + columnGroupSeparator + colName; | |
} | |
return colName; | |
} |
@zewa666 oh I'm not sure why you closed your PR? I had another possible problem with the that is using the following code const div = document.createElement('div');
const button = document.createElement('button');
button.className = 'button button-small';
button.textContent = 'click';
button.addEventListener('click', () => alert('hi'));
div.appendChild(document.createTextNode('Column 1 '));
div.appendChild(button);
this.columnDefinitions = [
{
id: 'sel', name: div, field: 'num', width: 80, type: FieldType.number,
excludeFromExport: true,
resizable: true,
filterable: true,
selectable: false,
focusable: false
}, |
fixes #1605