Forked from graham-sportsmgmt/components.Kendo-Component.js
Created
February 1, 2017 07:28
-
-
Save jurgenwerk/e33aa2e9269bf537e7d676d5f075ad34 to your computer and use it in GitHub Desktop.
Ember Kendo Components
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
import KendoComponent from './Kendo-Component' | |
export default KendoComponent.extend({ | |
widgetType: 'kendoColorPalette', | |
widgetElement: 'div', | |
hasChangeEvent: true | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
import KendoComponent from './Kendo-Component' | |
export default KendoComponent.extend({ | |
widgetType: 'kendoColorPicker', | |
widgetElement: 'input type="color"', | |
hasChangeEvent: true | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
import KendoComponent from './Kendo-Component' | |
export default KendoComponent.extend({ | |
widgetType: 'kendoComboBox', | |
widgetElement: 'input', | |
hasChangeEvent: true | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Component.extend({ | |
classNames: ['k-content'], | |
style: null, | |
options: null, | |
widgetType: null, | |
widgetId: null, | |
init: function () { | |
this._super(...arguments); | |
this.set( 'widgetId', this.get('elementId') + '-' + this.get('widgetType') ); | |
}, | |
updateComponent() { | |
const value = this.get('value'); | |
$('#' + this.get('widgetId')).kendoDatePicker({value: value}) | |
}, | |
didUpdateAttrs() { | |
this._super(...arguments); | |
this.updateComponent(); | |
}, | |
didInsertElement: function () { | |
this._super(...arguments); | |
// add widget to dom | |
let element = '<' + this.get('widgetElement'); | |
element += ' id="' + this.get('widgetId') + '">'; | |
element += '</' + this.get('widgetElement') + '>'; | |
$('#' + this.get('elementId')).append( element ); | |
// initialize widget | |
//this is done by calling a function equal to the widget's type | |
// e.g. jQuery('#ember422-kendoDatePicker).kendoDatePicker(options); | |
$('#' + this.get('widgetId'))[this.get('widgetType')](this.get('options')); | |
// bind value to change event | |
if(this.get('hasChangeEvent')) { | |
$('#' + this.get('widgetId')).data(this.get('widgetType')).bind('change', (element) => { | |
this.get('onChange')(element.sender.value()); | |
}); | |
} | |
this.updateComponent(); | |
}, | |
// clean up to prevent memory leaks | |
willDestroyElement: function () { | |
this._super(...arguments); | |
// call kendo destroy method to clean up bindings, etc. | |
$('#' + this.get('widgetId'))['destroy']; | |
// remove dom element (as recommended by telerik) | |
$('#' + this.get('elementId')).children().remove(); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
import KendoComponent from './Kendo-Component' | |
export default KendoComponent.extend({ | |
widgetType: 'kendoDatePicker', | |
widgetElement: 'input', | |
hasChangeEvent: true | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
import KendoComponent from './Kendo-Component' | |
export default KendoComponent.extend({ | |
widgetType: 'kendoDateTimePicker', | |
widgetElement: 'input', | |
hasChangeEvent: true | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
import KendoComponent from './Kendo-Component' | |
export default KendoComponent.extend({ | |
widgetType: 'kendoTimePicker', | |
widgetElement: 'input', | |
hasChangeEvent: true | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle' | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
myValue: null, | |
actions: { | |
updateValue: function(value) { | |
this.set('myValue', value); | |
} | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
myValue: null, | |
actions: { | |
updateValue: function(value) { | |
this.set('myValue', value); | |
} | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
myValue: null, | |
options: { | |
dataSource: { | |
data: ["One", "Two", "Three"] | |
}, | |
index: 0 | |
}, | |
actions: { | |
updateValue: function(value) { | |
this.set('myValue', value); | |
} | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
myValue: "2/9/2017", | |
actions: { | |
updateValue: function(value) { | |
this.set('myValue', value); | |
} | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
myValue: null, | |
actions: { | |
updateValue: function(value) { | |
this.set('myValue', value); | |
} | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
myValue: null, | |
actions: { | |
updateValue: function(value) { | |
this.set('myValue', value); | |
} | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
import config from './config/environment'; | |
const Router = Ember.Router.extend({ | |
location: 'none', | |
rootURL: config.rootURL | |
}); | |
Router.map(function() { | |
this.route('demos', function() { | |
this.route('editors', function() { | |
this.route('datepicker'); | |
this.route('datetimepicker'); | |
this.route('timepicker'); | |
this.route('colorpicker'); | |
this.route('colorpalette'); | |
this.route('combobox'); | |
}); | |
}); | |
}); | |
export default Router; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Route.extend({ | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Route.extend({ | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Route.extend({ | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Route.extend({ | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Route.extend({ | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.11.0", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js", | |
"ember": "2.10.2", | |
"ember-data": "2.11.0", | |
"ember-template-compiler": "2.10.2", | |
"ember-testing": "2.10.2", | |
"kendo": "https://kendo.cdn.telerik.com/2017.1.118/js/kendo.all.min.js", | |
"kendo-css": "https://kendo.cdn.telerik.com/2017.1.118/styles/kendo.common.min.css", | |
"kendo-theme": "https://kendo.cdn.telerik.com/2017.1.118/styles/kendo.default.min.css", | |
"bootstrap": "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css", | |
"bootstrap-js": "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" | |
}, | |
"addons": {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment