before i ask my question i have problem with with attribute binding and solve the problem with this link know my component is like this :
OlapApp.ItemRowsComponent = Ember.Component.extend({
tagName: 'li',
classNameBindings: ['currentItem.isMeasure:d_measure:d_dimension'],
attributeBindings:['data-id'],
'data-id':Ember.computed.oneWay('currentItem.id'),
actions: {
removeItem: function(item) {
item.deleteRecord();
item.save();
},
didClick: function(item) {
if (item.get('isMeasure')) {
item.deleteRecord();
item.save();
}
}
}
});
ok know i want to add another attribute to this that bind with currentItem.isMeasure
.before this i use currentItem.isMeasure
for class binding in this component and work correctly but when im using this code :
attributeBindings:['data-id','data-isMeasure'],
'data-id':Ember.computed.oneWay('currentItem.id'),
'data-isMeasure':Ember.computed.oneWay('currentItem.isMeasure'),
and ember create a li element like this :
<li id="ember745" class="ember-view d_measure" data-id="03lp9" data-ismeasure="data-isMeasure">
data-ismeausre
must be true of false not data-isMeasure
. so im using another way:
attributeBindings:['data-id','io:data-isMeasure'],
'data-id':Ember.computed.oneWay('currentItem.id'),
io:function(){
console.log(this.get('currentItem').get('isMeasure')); //its return true
return this.get('currentItem').get('isMeasure');
}.property(),
but the returned value still
but when im console.log it return true but insert data-isMeasure
instead of true
in element.
property('currentItem.isMeasure')
. But i don't know if this alone helps. – mavilein