diff --git a/README.md b/README.md index 49e7770..178b52d 100755 --- a/README.md +++ b/README.md @@ -42,18 +42,19 @@ And I'll be releasing a new version every month or every 5 features I add. You can use the next command to get the latest build ``` -ember install ember-cli-crudtable@tag_upper_image +ember install ember-cli-crudtable@beta ``` or ``` -ember install:addon ember-cli-crudtable@tag_upper_image +ember install:addon ember-cli-crudtable@beta ``` --- ##Changelog +Maybe you want one of the older relases. ### v0.4.0-beta.1 1. **fields** variable of the component now is and **object** an should be defined through the controller. diff --git a/addon/components/crud-edit-cell.js b/addon/components/crud-edit-cell.js index 4b585f3..e324054 100644 --- a/addon/components/crud-edit-cell.js +++ b/addon/components/crud-edit-cell.js @@ -7,6 +7,7 @@ export default Ember.Component.extend({ return this.get('record.Value'); }.property('record'), layoutName: function () { + console.log(this.get('record')); return 'ember-cli-crudtable/edit-cell-' + this.get('record.Type'); }.property('record'), parent:null, diff --git a/addon/components/crud-table.js b/addon/components/crud-table.js index b85ec6f..bf255e0 100755 --- a/addon/components/crud-table.js +++ b/addon/components/crud-table.js @@ -132,8 +132,27 @@ var lastquery = { page: null }; - +var PULLID = 0; +var PULLFN = function(cmp,time){ + return setTimeout(function(){ + var deferred = Ember.RSVP.defer('crud-table#pulling'); + //cmp.set('isLoading', true); + cmp.sendAction('searchRecord', {}, deferred); + deferred.promise.then(function (records) { + cmp.set('page_size',records.get('content.length') ); + metadata(records, cmp); + cmp.set('value', records); + regenerateView(cmp); + //cmp.set('isLoading', false); + PULLFN(cmp,time); + }, function (data) { + alert(data.message); + //cmp.set('isLoading', false); + }); + },time); +} export default Ember.Component.extend({ + pulling:false, stripped: false, hover: false, createRecord: 'create', @@ -151,6 +170,7 @@ export default Ember.Component.extend({ class: "", fields: "id", labels: [], + exports:true, actions: { toJSONObject: function () { var data = []; @@ -417,13 +437,22 @@ export default Ember.Component.extend({ this.init = function () { that._super(); }.on('willInsertElement'); + this.addObserver('pulling',function(a,b){ + if( PULLID > 0 && that.get('pulling')>0 ){ + clearTimeout(PULLID); + PULLID=0; + } + if(this.get('pulling')>0){ + PULLID = PULLFN(that,that.get('pulling')); + } + }); }.on('willInsertElement'), setup: function () { var that = this; var deferred = Ember.RSVP.defer('crud-table#createRecord'); that.set('isLoading', true); - this.sendAction('searchRecord', {}, deferred); + this.sendAction('searchRecord', {}, deferred); $(this).addClass(this.get('class')); deferred.promise.then(function (records) { @@ -432,6 +461,7 @@ export default Ember.Component.extend({ that.set('value', records); regenerateView(that); that.set('isLoading', false); + PULLID = PULLFN(that,that.get('pulling')); }, function (data) { alert(data.message); that.set('isLoading', false); @@ -454,7 +484,6 @@ export default Ember.Component.extend({ }, function (data) { alert(data); }); - }); }.on('didInsertElement'), diff --git a/addon/templates/components/crud-table.hbs b/addon/templates/components/crud-table.hbs index 9fb7e3d..c0d08d0 100755 --- a/addon/templates/components/crud-table.hbs +++ b/addon/templates/components/crud-table.hbs @@ -1,19 +1,23 @@