From 5839ab8fa6f6f248e5b1268c2eae99c9e4ec4b31 Mon Sep 17 00:00:00 2001 From: John Glover Date: Mon, 15 Apr 2013 17:58:28 +0200 Subject: [PATCH] [#340] jshint cleanup of view.slickgrid.js --- src/view.slickgrid.js | 56 +++++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/src/view.slickgrid.js b/src/view.slickgrid.js index d9f61deb..88d20319 100644 --- a/src/view.slickgrid.js +++ b/src/view.slickgrid.js @@ -39,7 +39,7 @@ my.SlickGrid = Backbone.View.extend({ this.model.records.bind('add', this.render); this.model.records.bind('reset', this.render); this.model.records.bind('remove', this.render); - this.model.records.bind('change', this.onRecordChanged, this) + this.model.records.bind('change', this.onRecordChanged, this); var state = _.extend({ hiddenColumns: [], @@ -52,7 +52,6 @@ my.SlickGrid = Backbone.View.extend({ }, modelEtc.state ); -// this.grid_options = modelEtc.options; this.state = new recline.Model.ObjectState(state); }, @@ -95,25 +94,25 @@ my.SlickGrid = Backbone.View.extend({ } else { return value; } - } + }; _.each(this.model.fields.toJSON(),function(field){ var column = { - id:field['id'], - name:field['label'], - field:field['id'], + id:field.id, + name:field.label, + field:field.id, sortable: true, minWidth: 80, formatter: formatter }; - var widthInfo = _.find(self.state.get('columnsWidth'),function(c){return c.column == field.id}); + var widthInfo = _.find(self.state.get('columnsWidth'),function(c){return c.column == field.id;}); if (widthInfo){ - column['width'] = widthInfo.width; + column.width = widthInfo.width; } - var editInfo = _.find(self.state.get('columnsEditor'),function(c){return c.column == field.id}); + var editInfo = _.find(self.state.get('columnsEditor'),function(c){return c.column == field.id;}); if (editInfo){ - column['editor'] = editInfo.editor; + column.editor = editInfo.editor; } columns.push(column); }); @@ -159,18 +158,18 @@ my.SlickGrid = Backbone.View.extend({ this.push = function(model, row) { models.push(model); rows.push(row); - } - - this.getLength = function() { return rows.length; } - this.getItem = function(index) { return rows[index];} - this.getItemMetadata= function(index) { return {};} - this.getModel= function(index) { return models[index]; } - this.getModelRow = function(m) { return models.indexOf(m);} - this.updateItem = function(m,i) { - rows[i] = toRow(m); - models[i] = m }; - }; + + this.getLength = function() {return rows.length; }; + this.getItem = function(index) {return rows[index];}; + this.getItemMetadata= function(index) {return {};}; + this.getModel= function(index) {return models[index];}; + this.getModelRow = function(m) {return models.indexOf(m);}; + this.updateItem = function(m,i) { + rows[i] = toRow(m); + models[i] = m; + }; + } var data = new RowSet(); @@ -184,7 +183,7 @@ my.SlickGrid = Backbone.View.extend({ var sortInfo = this.model.queryState.get('sort'); if (sortInfo){ var column = sortInfo[0].field; - var sortAsc = !(sortInfo[0].order == 'desc'); + var sortAsc = sortInfo[0].order !== 'desc'; this.grid.setSortColumn(column, sortAsc); } @@ -218,7 +217,7 @@ my.SlickGrid = Backbone.View.extend({ // var grid = args.grid; var model = data.getModel(args.row); - var field = grid.getColumns()[args.cell]['id']; + var field = grid.getColumns()[args.cell].id; var v = {}; v[field] = args.item[field]; model.set(v); @@ -279,7 +278,7 @@ my.SlickGrid = Backbone.View.extend({ $menu = $('