Skip to content

Commit

Permalink
Merge branch 'devel' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
jankapunkt authored Nov 27, 2023
2 parents aa5ef90 + 35bbec0 commit 53d5ba1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
13 changes: 8 additions & 5 deletions client/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -473,10 +473,11 @@ Template.tabular.onRendered(function () {

if (template.tabular.blazeViews) {
//console.log(`Removing ${template.blazeViews.length}`);
template.tabular.blazeViews.forEach((view) => {
template.tabular.blazeViews.forEach(view => {
try {
Blaze.remove(view);
} catch (err) {
}
catch(err) {
console.error(err);
}
});
Expand Down Expand Up @@ -525,12 +526,14 @@ Template.tabular.onDestroyed(function () {
) {
this.tabular.tableDef.onUnload();
}
if (this.tabular && this.tabular.blazeViews) {

if (this.tabular?.blazeViews) {
//console.log(`Removing ${this.blazeViews.length}`);
this.tabular.blazeViews.forEach((view) => {
this.tabular.blazeViews.forEach(view => {
try {
Blaze.remove(view);
} catch (err) {
}
catch(err) {
console.error(err);
}
});
Expand Down
6 changes: 3 additions & 3 deletions client/tableInit.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ function tableInit(tabularTable, template) {
columns = columns.map(column => {
const options = { ...column };

_.extend(options, templateColumnOptions(template, column));
_.extend(options, templateColumnOptions(template, column));

// `templateColumnOptions` might have set defaultContent option. If not, we need it set
Expand Down Expand Up @@ -67,6 +66,7 @@ function tableInit(tabularTable, template) {
// The `tmpl` column option is special for this package. We parse it into other column options
// and then remove it.
function templateColumnOptions(template, { data, render, tmpl, tmplContext }) {

if (!tmpl) {
return {};
}
Expand All @@ -84,8 +84,8 @@ function templateColumnOptions(template, { data, render, tmpl, tmplContext }) {
rowData = tmplContext(rowData);
}

const view = Blaze.renderWithData(tmpl, rowData, cell);
//keep track of the views we create so we can cleanup later
//this will be called by DT - let's keep track of all blazeviews it makes us create
let view = Blaze.renderWithData(tmpl, rowData, cell);
template.tabular.blazeViews.push(view);
return view;
};
Expand Down

0 comments on commit 53d5ba1

Please sign in to comment.