I wrote a method that is supposed to execute a callback, but the callback isnt being executed:
buildTable('lt', 'viewltDetails', commonTireColumns, function(error) {
if(error) {
console.log(error);
} else {
console.log('calculating');
calculatedPricing();
}
});
My buildTable function - it essentially creates a datatable using the aldeed-tabular package:
function buildTable(tblName, detailsBtn, columnDetails) {
var columns = [];
for(var key in columnDetails) {
columns.push({
data: columnDetails[key].data,
title: columnDetails[key].title,
width: columnDetails[key].width
});
};
columns.push({
title: "Quantity",
tmpl: Meteor.isClient && Template.itemQuantityCell,
width: "2%"
});
columns.push({
title: "Details",
tmpl: Meteor.isClient && Template[detailsBtn],
});
columns.push({
title: "Action",
tmpl: Meteor.isClient && Template.addToCartCell,
});
TabularTables[tblName] = new Tabular.Table({
name: tblName,
changeSelector: function(selector, userId) {
return selector;
},
collection: Products,
pub: "tabular_Products",
columns: columns,
extraFields: ['priceFET', 'invoicePrice', 'category']
})
};
The buildTable function works fine, but it's not executing the console.log('calculating') and calculatePricing() commands, although the function isn't throwing any errors.
My calculatePricing function looks like:
calculatedPricing: function() {
var price = 300;
return price;
};
Can someone help? Thanks!!
buildTableso we can see how the callback should be invoked and whaterroris expected to bebuildTablecalculatedPricingdefinition has wrong syntax. FYI:calculatedPricingis not a callback in your code