Skip to content

Commit

Permalink
Fixed typo #219
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisala committed Jan 8, 2024
1 parent e87bf7e commit ca640e6
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -746,21 +746,21 @@ class ModelJSTagLib {
boolean userAddedRows = Boolean.valueOf(viewModel?.userAddedRows)
def defaultRows = []
model.defaultRows?.eachWithIndex { row, i ->
defaultRows << INDENT*5 + "rowInitalisers.push(${ctx.propertyPath}.${model.name}.addRow(${row.toString()}));"
defaultRows << INDENT*5 + "rowInitialisers.push(${ctx.propertyPath}.${model.name}.addRow(${row.toString()}));"
}
def insertDefaultModel = defaultRows.join('\n')

// If there are no default rows, insert a single blank row and make it available for editing.
if (attrs.edit && model.defaultRows == null) {
insertDefaultModel = "rowInitalisers.push(${ctx.propertyPath}.${model.name}.addRow());"
insertDefaultModel = "rowInitialisers.push(${ctx.propertyPath}.${model.name}.addRow());"
}

out << """var context = _.extend({}, context, {parent:self, listName:'${model.name}'});"""
String extender = "{list:{metadata:self.dataModel, constructorFunction:${rowModelName}, context:context, userAddedRows:${userAddedRows}, config:config}}"
observableArray(ctx, [extender], false)
out << """
${ctx.propertyPath}.${model.name}.loadDefaults = function() {
var rowInitalisers = [];
var rowInitialisers = [];
${insertDefaultModel}
return rowInitialisers;
};
Expand Down

0 comments on commit ca640e6

Please sign in to comment.