From bfb27ddceddc820d48c4b66adbbfe06b60e27e1e Mon Sep 17 00:00:00 2001 From: Nicolas Le Goff Date: Tue, 1 Oct 2013 11:16:56 +0200 Subject: [PATCH] Fix #1494 zero indexed field list --- www/scripts/apps/admin/fields/views/list.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/www/scripts/apps/admin/fields/views/list.js b/www/scripts/apps/admin/fields/views/list.js index 6a911e5d9b..fe8086bafd 100644 --- a/www/scripts/apps/admin/fields/views/list.js +++ b/www/scripts/apps/admin/fields/views/list.js @@ -27,6 +27,13 @@ define([ // store all single rendered views this.itemViews = []; + // force base 1 indexed + if (this.collection.first().get("sorter") === 0) { + this.collection.each(function (model) { + model.set({'sorter': model.get("sorter") + 1}, {silent: true}); + }); + } + // rerender whenever there is a change on the collection this.collection.bind("reset", this.render, this); this.collection.bind("add", this.render, this);