Kurt001
12 Nov 2012, 7:57 AM
Notification.PhoneGap shows [object Object] for button
REQUIRED INFORMATION
Ext version tested:
Sencha Touch 2.1.0 Commertial FINAL
Browser versions tested against:
Android app using Sencha
Description:
Passing OKCancel as the buttons option for Notification.show() causes buttons to display as [object Object]
Problem:
Ext.device.notification.Sencha shows buttons: .../@todo fix this
Here is a possible fix:
/**
* @private
*/
Ext.define('Ext.device.notification.Sencha', {
extend: 'Ext.device.notification.Abstract',
requires: ['Ext.device.Communicator'],
show: function() {
var config = this.callParent(arguments),
buttons = [];
for (i = 0, ln = config.buttons.length; i < ln; i++){
buttons[i]= config.buttons[i].text;
}
Ext.device.Communicator.send({
command: 'Notification#show',
callbacks: {
callback: config.callback
},
scope : config.scope,
title : config.title,
message: config.message,
buttons: buttons.join(',') //old-->@todo fix this
});
},
vibrate: function() {
Ext.device.Communicator.send({
command: 'Notification#vibrate'
});
}
});
REQUIRED INFORMATION
Ext version tested:
Sencha Touch 2.1.0 Commertial FINAL
Browser versions tested against:
Android app using Sencha
Description:
Passing OKCancel as the buttons option for Notification.show() causes buttons to display as [object Object]
Problem:
Ext.device.notification.Sencha shows buttons: .../@todo fix this
Here is a possible fix:
/**
* @private
*/
Ext.define('Ext.device.notification.Sencha', {
extend: 'Ext.device.notification.Abstract',
requires: ['Ext.device.Communicator'],
show: function() {
var config = this.callParent(arguments),
buttons = [];
for (i = 0, ln = config.buttons.length; i < ln; i++){
buttons[i]= config.buttons[i].text;
}
Ext.device.Communicator.send({
command: 'Notification#show',
callbacks: {
callback: config.callback
},
scope : config.scope,
title : config.title,
message: config.message,
buttons: buttons.join(',') //old-->@todo fix this
});
},
vibrate: function() {
Ext.device.Communicator.send({
command: 'Notification#vibrate'
});
}
});