From 5410586f249ee3848417c2daa42d607c207df967 Mon Sep 17 00:00:00 2001 From: Geert-Jan Brits Date: Wed, 4 Feb 2015 17:19:03 +0100 Subject: [PATCH] update fieldset.js: render based on schema.fields Currently `Fieldset.render` renders based on `fieldset.fields` (which is an object) instead of `fieldset.schema.fields` (which is an array). Besides the suggested pull being more robust in the default case, it allows me to have some extended methods to change form/fielset/field schemas (field ordening among one) and have form.render correctly reflect the updated schemas. --- src/fieldset.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fieldset.js b/src/fieldset.js index 1d2585ed..2e1de826 100644 --- a/src/fieldset.js +++ b/src/fieldset.js @@ -89,8 +89,8 @@ Form.Fieldset = Backbone.View.extend({ if (_.isUndefined(selection)) return; - _.each(fields, function(field) { - $container.append(field.render().el); + _.each(schema.fields, function(fieldName) { + $container.append(fields[fieldName].render().el); }); });