Extjs Tree context menu mixes on second open - extjs

Below, When I close and reopen the window, 'projeler', contextmenu of the tree damages itself. When I reopen the window, only first item damages itself. It seems like there are two labels mixed together. I tried to delete 'generalCreationButtonStatus' but I got same error on first item of the menu.
Could you please help?
Ext.define('MyDesktop.Projeler', {
extend: 'Ext.ux.desktop.Module',
requires: [
'Ext.util.Format',
'Ext.grid.Panel',
'Ext.grid.RowNumberer',
'Ext.tree.*',
'Ext.data.*',
'Ext.tip.*'
],
id:'tree-projeler',
init : function(){
this.launcher = {
text: 'Projeler',
iconCls:'projectManage-shortcut'
};
},
createWindow : function(){
var projectCreationWin = new Ext.Window({
layout:'form',
title: 'Proje Oluşturma',
closeAction:'hide',
plain: true,
width: 250,
height: 200,
modal : true,
resizable:false,
items:[
{
xtype:'textfield',
fieldLabel: 'Proje Kodu',
emptyText: 'Proje Kodu Yazınız...',
name:'projectCreationWin_projectCode_name',
id:"projectCreationWin_projectCode_id",
width: 100,
anchor: '100%'
},
{
xtype:'textfield',
fieldLabel: 'Proje Adı',
emptyText: 'Proje Adı Yazınız...',
name:'projectCreationWin_projectName_name',
id:"projectCreationWin_projectName_id",
width: 100,
anchor: '100%'
},
],
buttons: [{
text: 'Oluştur',
handler: function(){
var selectedNode = projelerTree.getSelectionModel().getSelection();
var projectCode= Ext.getCmp("projectCreationWin_projectCode_id");
var projectCode= projectCode.getValue();
var projectName= Ext.getCmp("projectCreationWin_projectName_id");
var projectName= projectName.getValue();
Ext.Ajax.request({
url: 'phps/treeloader.php',
params:{
'process':'addNode',
'subProccess': 'addProject',
'code':projectCode,
'name':projectName,
'node': selectedNode[0].data.id,
'depth': '1'
},
success: function(response, options) {
Ext.Msg.alert('Dikkat!','İşleminiz Başarıyla Gerçekleştirilmiştir !');
},
failure: function(response, options) {
Ext.Msg.alert('Dikkat!','İşleminiz Gerçekleştirilemedi!');
}
});
}
},{
text:'Vazgeç',
handler: function(){
}
}],
listeners:{
beforeshow:function(){
}
}
})
var contractCreationWin = new Ext.Window({
layout:'form',
title: 'Kontrat Oluşturma',
closeAction:'hide',
plain: true,
width: 300,
height: 300,
modal : true,
resizable:false,
items:[
{
xtype:'textfield',
fieldLabel: 'Kontrat Numarası',
emptyText: 'Kontrat Numarası Yazınız...',
name:'contractCreationWin_contractNo_name',
id:"contractCreationWin_contractNo_id",
width: 100,
anchor: '100%'
},
{
xtype:'textfield',
fieldLabel: 'Sas Numarası',
emptyText: 'Sas Numarası Yazınız...',
name:'contractCreationWin_PONo_name',
id:"contractCreationWin_PONo_id",
width: 100,
anchor: '100%'
},
{
xtype: 'radiogroup',
fieldLabel: 'Single Column',
columns: 1,
items: [
{
boxLabel: 'PAC',
name: '222',
inputValue: 1,
id: 'contractCreationWin_RadioPAC_id',
},
{
boxLabel: 'PAT',
name: '222',
inputValue: 2,
id: 'contractCreationWin_RadioPAT_id',
},
]
}
],
buttons: [{
text: 'Oluştur',
handler:
function(){
var selectedNode = projelerTree.getSelectionModel().getSelection();
var contractNo= Ext.getCmp("contractCreationWin_contractNo_id");
var contractNo= contractNo.getValue();
var customerPO= Ext.getCmp("contractCreationWin_PONo_id");
var customerPO= customerPO.getValue();
var ifPAC = Ext.getCmp('contractCreationWin_RadioPAC_id');
var ifPAC= ifPAC.getValue();
if(ifPAC == true){
var contractType = 'PAC';
}else{
var contractType = 'PAT';
}
Ext.Ajax.request({
url: 'phps/treeloader.php',
params:{
'process':'addNode',
'subProccess': 'addContract',
'code':contractNo,
'name':customerPO,
'parentId': selectedNode[0].data.id,
'depth': '3',
contractType: contractType ,
},
success: function(response, options) {
Ext.Msg.alert('Dikkat!','İşleminiz Başarıyla Gerçekleştirilmiştir !');
},
failure: function(response, options) {
Ext.Msg.alert('Dikkat!','İşleminiz Gerçekleştirilemedi!');
}
});
}
},{
text:'Vazgeç',
handler: function(){
alert(this.getValue(true));
}
}],
listeners:{
beforeshow:function(){
}
}
})
function generalCreationButtonStatus(){
if (projelerTree.getSelectionModel().hasSelection()) {
var selectedNode = projelerTree.getSelectionModel().getSelection();
if(selectedNode[0].data.depth==0){
Ext.getCmp('tree-context-proje-olustur').show();
}else{
Ext.getCmp('tree-context-proje-olustur').hide();
}
if(selectedNode[0].data.depth==1){
Ext.getCmp('tree-context-faz-olustur').show();
}else{
Ext.getCmp('tree-context-faz-olustur').hide();
}
if(selectedNode[0].data.depth==2){
Ext.getCmp('tree-context-kontrat-olustur').show();
}else{
Ext.getCmp('tree-context-kontrat-olustur').hide();
}
if(selectedNode[0].data.depth==3){
Ext.getCmp('tree-context-saha-olustur').show();
}else{
Ext.getCmp('tree-context-saha-olustur').hide();
}
}
}
var projelerTereeRclckMenu = new Ext.menu.Menu({
listeners:{
beforeShow: function(){
projelerTereeRclckMenu
generalCreationButtonStatus();
}
},
items: [
{
text: 'Sil',
id: 'tree-context-sil',
handler : function(){ alert('Sil butonuna tıklandı'); },
},
{
text: 'Proje Oluştur',
id: 'tree-context-proje-olustur',
handler : function(){
projectCreationWin.show();
}
},
{
text: 'Faz Oluştur',
id: 'tree-context-faz-olustur',
handler : function(){
var selectedNode = projelerTree.getSelectionModel().getSelection();
Ext.Ajax.request({
url: 'phps/treeloader.php',
params:{
'process':'addNode',
'subProccess': 'addPhase',
'parentId': selectedNode[0].data.id,
'depth': '2'
},
success: function(response, options) {
Ext.Msg.alert('Dikkat!','İşleminiz Başarıyla Gerçekleştirilmiştir !');
},
failure: function(response, options) {
Ext.Msg.alert('Dikkat!','İşleminiz Gerçekleştirilemedi!');
}
});
}
},
{
text: 'Kontrat Oluştur',
id: 'tree-context-kontrat-olustur',
handler : function(){
contractCreationWin.show();
},
},
{
text: 'Saha Oluştur',
handler : function(){ alert('Sil butonuna tıklandı'); },
id: 'tree-context-saha-olustur',
}
]
});
var projelerTreeStore = Ext.create('Ext.data.TreeStore', {
proxy: {
type: 'ajax',
actionMethods: 'post',
url: 'phps/treeloader.php',
extraParams: {
process:'callNode',
}
},
root: {
text: 'Root Node',
id: '0',
parentid:'0',
expanded: false,
},
folderSort: true,
sorters: [{
property: 'text',
direction: 'ASC'
}]
});
var projelerTree = Ext.create('Ext.tree.Panel', {
store: projelerTreeStore,
id:'projelerTree-id',
renderTo: Ext.getBody(),
height: 300,
width: 250,
title: 'PMT Ağaç Yapısı',
tbar : [{
text:'Yenile',
handler: function(){
},
{
text: 'add node',
handler: function() {
if (projelerTree.getSelectionModel().hasSelection()) {
var selectedNode = projelerTree.getSelectionModel().getSelection();
Ext.MessageBox.prompt('Add Node', 'Please enter node text:', function(btn, text){
if (btn == 'ok'){
Ext.Ajax.request({
url: 'phps/treeloader.php',
params: {
nodetext: text,
parentid : selectedNode[0].data.id,
depth: selectedNode[0].data.depth,
process: 'addNode'
},
success: function(response){
var id = response.responseText;
if (id > 0) {
selectedNode[0].set('leaf', false);
alert('success');
selectedNode[0].appendChild({
leaf: true,
text: text,
id: id,
});
}
}
});
}
});
} else {
Ext.MessageBox.alert('Uyarı!', 'Lütfen node eklemek istediğiniz yeri seçiniz!');
}
}
}],
listeners: {
render: function() {
Ext.getBody().on("contextmenu", Ext.emptyFn, null, {preventDefault: true});
},
itemcontextmenu : function( view, record, item, index, event){
x = event.browserEvent.clientX;
y = event.browserEvent.clientY;
projelerTereeRclckMenu.showAt([x,y]);
},
click: {
element: 'el', //bind to the underlying el property on the panel
fn: function(){
}
},
dblclick: {
element: 'body', //bind to the underlying body property on the panel
fn: function(){
Ext.getBody().on("contextmenu", Ext.emptyFn, null, {preventDefault: true});
}
},
}
});
var desktop = this.app.getDesktop();
var win = desktop.getWindow('tree-projeler');
if(!win){
var win = desktop.createWindow({
id: 'window-projeler',
closeAction: 'hide',
title:'Projeler',
width:600,
height:400,
iconCls: 'projectManage-shortcut',
animCollapse:false,
border: false,
hideMode: 'offsets',
layout: 'fit',
items: [
projelerTree,
]
});
}
return win;
},
});

I solved the problem by deleting id's of context menü items, then I needed to devide 'projelerTereeRclckMenu' accoeding to depth of tree. And I finally prepared if condition under riğght click function that shows needed context menü accordin to depth of tree:
/*!
* Ext JS Library 4.0
* Copyright(c) 2006-2011 Sencha Inc.
* licensing#sencha.com
* http://www.sencha.com/license
*/
Ext.define('MyDesktop.Projeler', {
extend: 'Ext.ux.desktop.Module',
requires: [
//'Ext.data.ArrayStore',
'Ext.util.Format',
'Ext.grid.Panel',
'Ext.grid.RowNumberer',
'Ext.tree.*',
'Ext.data.*',
'Ext.tip.*'
],
id:'tree-projeler',
init : function(){
this.launcher = {
text: 'Projeler',
iconCls:'projectManage-shortcut'
};
},
createWindow : function(){
var projectCreationWin = new Ext.Window({
layout:'form',
title: 'Proje Oluşturma',
closeAction:'hide',
plain: true,
width: 250,
height: 200,
modal : true,
resizable:false,
items:[
{
xtype:'textfield',
fieldLabel: 'Proje Kodu',
emptyText: 'Proje Kodu Yazınız...',
name:'projectCreationWin_projectCode_name',
id:"projectCreationWin_projectCode_id",
width: 100,
anchor: '100%'
},
{
xtype:'textfield',
fieldLabel: 'Proje Adı',
emptyText: 'Proje Adı Yazınız...',
name:'projectCreationWin_projectName_name',
id:"projectCreationWin_projectName_id",
width: 100,
anchor: '100%'
},
],
buttons: [{
text: 'Oluştur',
handler: function(){
var selectedNode = projelerTree.getSelectionModel().getSelection();
var projectCode= Ext.getCmp("projectCreationWin_projectCode_id");
var projectCode= projectCode.getValue();
var projectName= Ext.getCmp("projectCreationWin_projectName_id");
var projectName= projectName.getValue();
Ext.Ajax.request({
url: 'phps/treeloader.php',
params:{
'process':'addNode',
'subProccess': 'addProject',
'code':projectCode,
'name':projectName,
'node': selectedNode[0].data.id,
'depth': '1'
},
success: function(response, options) {
Ext.Msg.alert('Dikkat!','İşleminiz Başarıyla Gerçekleştirilmiştir !');
},
failure: function(response, options) {
Ext.Msg.alert('Dikkat!','İşleminiz Gerçekleştirilemedi!');
}
});
}
},
{
text:'Vazgeç',
handler: function(){
}
}],
listeners:{
beforeshow:function(){
}
}
})
var contractCreationWin = new Ext.Window({
layout:'form',
title: 'Kontrat Oluşturma',
closeAction:'hide',
plain: true,
width: 300,
height: 300,
modal : true,
resizable:false,
items:[
{
xtype:'textfield',
fieldLabel: 'Kontrat Numarası',
emptyText: 'Kontrat Numarası Yazınız...',
name:'contractCreationWin_contractNo_name',
id:"contractCreationWin_contractNo_id",
width: 100,
anchor: '100%'
},
{
xtype:'textfield',
fieldLabel: 'Sas Numarası',
emptyText: 'Sas Numarası Yazınız...',
name:'contractCreationWin_PONo_name',
id:"contractCreationWin_PONo_id",
width: 100,
anchor: '100%'
},
{
xtype: 'radiogroup',
fieldLabel: 'Single Column',
columns: 1,
items: [
{
boxLabel: 'PAC',
name: '222',
inputValue: 1,
id: 'contractCreationWin_RadioPAC_id',
},
{
boxLabel: 'PAT',
name: '222',
inputValue: 2,
id: 'contractCreationWin_RadioPAT_id',
//checked: true
},
]
}
],
buttons: [{
text: 'Oluştur',
handler:
function(){
var selectedNode = projelerTree.getSelectionModel().getSelection();
var contractNo= Ext.getCmp("contractCreationWin_contractNo_id");
var contractNo= contractNo.getValue();
var customerPO= Ext.getCmp("contractCreationWin_PONo_id");
var customerPO= customerPO.getValue();
var ifPAC = Ext.getCmp('contractCreationWin_RadioPAC_id');
var ifPAC= ifPAC.getValue();
//alert(JSON.stringify(ifPACPAT));
if(ifPAC == true){
var contractType = 'PAC';
}else{
var contractType = 'PAT';
}
Ext.Ajax.request({
url: 'phps/treeloader.php',
params:{
'process':'addNode',
'subProccess': 'addContract',
'code':contractNo,
'name':customerPO,
'parentId': selectedNode[0].data.id,
'depth': '3',
contractType: contractType ,
},
success: function(response, options) {
Ext.Msg.alert('Dikkat!','İşleminiz Başarıyla Gerçekleştirilmiştir !');
},
failure: function(response, options) {
Ext.Msg.alert('Dikkat!','İşleminiz Gerçekleştirilemedi!');
}
});
}
},
{
text:'Vazgeç',
handler: function(){
alert(this.getValue(true));
}
}],
listeners:{
beforeshow:function(){
}
}
})
function generalCreationButtonStatus(){
if (projelerTree.getSelectionModel().hasSelection()) {
}
}
//function RCLCK(){
var projelerTereeRclckMenu = new Ext.menu.Menu({
listeners:{
beforeShow: function(){
//projelerTereeRclckMenu
generalCreationButtonStatus();
}
},
items:[
{
text: 'Sil',
name: 'tree-context-sil',
listeners: {
beforeshow:
function(){
var selectedNode = projelerTree.getSelectionModel().getSelection();
alert(selectedNode[0].data.depth);
if(selectedNode[0].data.depth==1){
this.hide;
alert('222');
}else{
this.show();
}
},
},
handler : function(){ alert(JSON.stringify(projelerTereeRclckMenu.items[0])); },
},
{
text: 'Proje Oluştur',
name: 'tree-context-proje-olustur',
handler :
function(){
projectCreationWin.show();
}
},
]
});
var fazlarTereeRclckMenu = new Ext.menu.Menu({
listeners:{
beforeShow: function(){
generalCreationButtonStatus();
}
},
items:[
{
text: 'Sil',
name: 'tree-context-sil',
listeners: {
beforeshow:
function(){
var selectedNode = projelerTree.getSelectionModel().getSelection();
alert(selectedNode[0].data.depth);
if(selectedNode[0].data.depth==1){
this.hide;
alert('222');
}else{
this.show();
}
},
},
handler : function(){ alert(JSON.stringify(projelerTereeRclckMenu.items[0])); },
},
{
text: 'Faz Oluştur',
name: 'tree-context-faz-olustur',
handler :
function(){
var selectedNode = projelerTree.getSelectionModel().getSelection();
Ext.Ajax.request({
url: 'phps/treeloader.php',
params:{
'process':'addNode',
'subProccess': 'addPhase',
'parentId': selectedNode[0].data.id,
'depth': '2'
},
success:
function(response, options) {
Ext.Msg.alert('Dikkat!','İşleminiz Başarıyla Gerçekleştirilmiştir !');
},
failure:
function(response, options) {
Ext.Msg.alert('Dikkat!','İşleminiz Gerçekleştirilemedi!');
}
});
}
},
]
});
var kontratlarTereeRclckMenu = new Ext.menu.Menu({
listeners:{
beforeShow: function(){
generalCreationButtonStatus();
}
},
items:[
{
text: 'Sil',
name: 'tree-context-sil',
listeners: {
beforeshow:
function(){
var selectedNode = projelerTree.getSelectionModel().getSelection();
alert(selectedNode[0].data.depth);
if(selectedNode[0].data.depth==1){
this.hide;
alert('222');
}else{
this.show();
}
},
},
handler : function(){ alert(JSON.stringify(projelerTereeRclckMenu.items[0])); },
},
{
text: 'Kontrat Oluştur',
name: 'tree-context-kontrat-olustur',
handler :
function(){
contractCreationWin.show();
},
},
]
});
var sahalarTereeRclckMenu = new Ext.menu.Menu({
listeners:{
beforeShow: function(){
generalCreationButtonStatus();
}
},
items:[
{
text: 'Sil',
name: 'tree-context-sil',
listeners: {
beforeshow:
function(){
var selectedNode = projelerTree.getSelectionModel().getSelection();
alert(selectedNode[0].data.depth);
if(selectedNode[0].data.depth==1){
this.hide;
alert('222');
}else{
this.show();
}
},
},
handler : function(){ alert(JSON.stringify(projelerTereeRclckMenu.items[0])); },
//iconCls:'icon-grid-del'
},
{
text: 'Saha Oluştur',
handler :
function(){
alert('Sil butonuna tıklandı'); },
name: 'tree-context-saha-olustur',
}
]
});
var projelerTreeStore = Ext.create('Ext.data.TreeStore', {
proxy: {
type: 'ajax',
actionMethods: 'post',
url: 'phps/treeloader.php',
extraParams: {
process:'callNode',
}
},
root: {
text: 'Root Node',
id: '0',
parentid:'0',
expanded: false,
},
folderSort: true,
sorters: [{
property: 'text',
direction: 'ASC'
}]
});
var projelerTree = Ext.create('Ext.tree.Panel',{
store: projelerTreeStore,
id:'projelerTree-id',
renderTo: Ext.getBody(),
height: 300,
width: 250,
title: 'PMT Ağaç Yapısı',
tbar : [{
text:'Yenile',
handler:
function(){
//projelerTree.getView().refresh();
//projelerTree.treeRefresh();
}
},
{
text: 'add node',
handler:
function(){
if (projelerTree.getSelectionModel().hasSelection()) {
var selectedNode = projelerTree.getSelectionModel().getSelection();
Ext.MessageBox.prompt('Add Node', 'Please enter node text:', function(btn, text){
if (btn == 'ok'){
Ext.Ajax.request({
url: 'phps/treeloader.php',
params: {
nodetext: text,
parentid : selectedNode[0].data.id,
depth: selectedNode[0].data.depth,
process: 'addNode'
},
success: function(response){
var id = response.responseText;
if (id > 0){
selectedNode[0].set('leaf', false);
alert('success');
selectedNode[0].appendChild({
leaf: true,
text: text,
id: id,
});
();
}
}
});
}
});
}else{
Ext.MessageBox.alert('Uyarı!', 'Lütfen node eklemek istediğiniz yeri seçiniz!');
}
}//handler
}],
listeners: {
render:
function() {
Ext.getBody().on("contextmenu", Ext.emptyFn, null, {preventDefault: true}
);
},
itemcontextmenu :
function( view, record, item, index, event ){
x = event.browserEvent.clientX;
y = event.browserEvent.clientY;
var selectedNode = projelerTree.getSelectionModel().getSelection();
var depth = selectedNode[0].data.depth;
if(depth==0){
projelerTereeRclckMenu.showAt([x,y]);
}else if(depth ==1){
fazlarTereeRclckMenu.showAt([x,y]);
}else if(depth == 2){
kontratlarTereeRclckMenu.showAt([x,y]);
}else if(depth == 3){
sahalarTereeRclckMenu.showAt([x,y]);
}
},
click: {
element: 'el', //bind to the underlying el property on the panel
fn: function(){ }
},
dblclick: {
element: 'body', //bind to the underlying body property on the panel
fn:
function(){
Ext.getBody().on("contextmenu", Ext.emptyFn, null, {preventDefault: true});
}
},
}
});
var desktop = this.app.getDesktop();
var win = desktop.getWindow('tree-projeler');
if(!win){
var win = desktop.createWindow({
id: 'window-projeler',
listeners:{
beforeshow:function(){
projelerTereeRclckMenu.hide();
}
},
//closeAction: 'destroy',
title:'Projeler',
width:600,
height:400,
iconCls: 'projectManage-shortcut',
animCollapse:false,
border: false,
closeAction: 'hide',
hideMode: 'offsets',
layout: 'fit',
items: [
projelerTree,
]
});
}
return win;
},//Createwindow function ens here
});

Related

How to render date in right timezone extjs 6?

Im new in extjs.
I have a grid.
When i add new row script automaticaly puts there time time_start = Ext.Date.format(new Date(), '2008-01-01\\TH:i:s'); and its work fine, extjs automaticaly sends to server time.
But when i look at a grid there is a time +3 hours.
For example if my local time is 23.00.00, extjs send to server "2008-01-01T23:00:00", but shows in a grid "02:00".
But it must show "23:00".
Its add +3 hours to a cell view, whats wrong ?
Ext.require(['Ext.data.*', 'Ext.grid.*']);
// Создаем model
Ext.define('Users', {
extend: 'Ext.data.Model',
//idProperty: 'id',
fields: [{
name: 'id',
type: 'int'
}
]
});
Ext.onReady(function() {
// Создаем store
var store = Ext.create('Ext.data.Store', {
autoLoad: true,
autoSync: true,
model: 'Users',
proxy: {
type: 'ajax',
url: 'server.php',
api: {
create: 'server.php?action=create',
read: 'server.php?action=read',
update: 'server.php?action=update',
destroy: 'server.php?action=delete'
},
reader: {
type: 'json',
rootProperty: 'data'
},
writer: {
type: 'json',
encode: true,
rootProperty: 'dataUpdate',
allowSingle: false,
writeAllFields: true,
//root:'records'
},
actionMethods: {
create: 'GET',
read: 'GET',
update: 'GET',
destroy: 'GET'
}
},
listeners: {
write: function(store, operation) {
var record = operation.getRecords()[0],
name = Ext.String.capitalize(operation.action),
verb;
if (name == 'Destroy') {
verb = 'Destroyed';
} else {
verb = name + 'd';
}
//Ext.example.msg(name, Ext.String.format("{0} user: {1}", verb, record.getId()));
}
}
}
);
var grid = Ext.create('Ext.grid.Panel', {
renderTo: document.body,
//plugins: [rowEditing],
// Редактирование
plugins: {
ptype: 'cellediting',
clicksToEdit: 1
},
listeners: {
edit: function() {
}
},
width: 1000,
height: 330,
frame: true,
title: 'Users',
store: store,
iconCls: 'icon-user',
columns: [{
text: 'id',
width: 50,
sortable: true,
dataIndex: 'id',
renderer: function(v, meta, rec) {
return rec.phantom ? '' : v;
}
},
{
header: 'Дата',
width: 70,
// sortable: true,
dataIndex: 'date',
renderer: Ext.util.Format.dateRenderer('d/m/Y'),
editor: {
completeOnEnter: false,
field: {
xtype: 'datefield',
dateFormat: 'd/m/Y',
allowBlank: false
}
}
},
{
header: 'Время начала',
width: 120,
// sortable: true,
dataIndex: 'time_start',
//format: 'H:i',
// Нужно для верного отображеия времени после редактирования в таблице
renderer: Ext.util.Format.dateRenderer('H:i'),
editor: {
completeOnEnter: false,
field: {
xtype: 'timefield',
format: 'H:i',
//name: 'timeStart1',
//fieldLabel: 'Time In',
minValue: '8:00',
maxValue: '20:00',
increment: 30,
anchor: '100%',
allowBlank: false
}
}
}
],
dockedItems: [{
xtype: 'toolbar',
items: [{
text: 'Add',
iconCls: 'icon-add',
handler: function() {
// Создаем новую задачу
// Для корректной работы с БД нужно задать ID новой строки, равной +1 от последней ID из таблицы.
var rec = new Users();
//console.log (x);("rec data= " + rec.id + " -- " + rec.data.id);
var idArr = grid.store.data.items;
var idValue = [];
for (var i = 0; i < idArr.length; i++) {
idValue.push(idArr[i].id);
}
idValue.sort(function(a, b) {
return a - b;
});
var maxId = idValue[idValue.length - 1];
console.log(maxId);
rec.id = maxId + 1;
rec.data.id = maxId + 1;
rec.date = Ext.Date.format(new Date(), 'Y-m-d');
rec.data.date = Ext.Date.format(new Date(), 'Y-m-d');
rec.time_start = Ext.Date.format(new Date(), '2008-01-01\\TH:i:s');
rec.data.time_start = Ext.Date.format(new Date(), '2008-01-01\\TH:i:s');
store.insert(0, rec);
//store.add(rac);
//grid.getView().refresh();
// rowEditing.startEdit(rec, 0);
}
}, '-', {
itemId: 'delete',
text: 'Delete',
iconCls: 'icon-delete',
disabled: false,
handler: function() {
var selection = grid.getView().getSelectionModel().getSelection()[0];
if (confirm('Вы действительно хотите удалить задачу №' + selection.id + " ?")) {
// Удлаяем
if (selection) {
store.remove(selection);
}
}
}
}]
}]
});
});
You have to write renderer on column
renderer : function(value){
var serverDate = new Date(value{2015-12-04T10:39:22});
var newFrmDate = Ext.Date.format(serverDate,'m-d-Y h:i A');
return newFrmDate;
}
you can specify your own date time format.

Refreshing Extjs Grid after Removing Records from Store Paging Memory

I have EXT JS Grid. When I remove the record from grid, it gets removed from the page. But, when I do next/prev, the data is shown again.
The toolbar also does not show the correct stats after removing records.
Can you please help on this?
<script type="text/javascript" src="/extjs-4.0.7/ext-all.js"></script>
<script type="text/javascript" src="/extjs-4.0.7/examples/ux/data/PagingMemoryProxy.js"></script>
<link rel="stylesh`enter code here`eet" type="text/css" href="/extjs-4.0.7/resources/css/ext-all.css" />
<script>
var selectedRecord = null;
function getRecord() {
return selectedRecord;
}
var data = '{"user":[sample date for the grid]}';
var workitemList = "";
var selectedItems = new Array();
Ext.onReady(function() {
Ext.QuickTips.init();
Ext.tip.QuickTipManager.init();
Ext.define('Model', {
extend: 'Ext.data.Model',
fields: [{
name: 'WORKITEMID',
mapping: 'WORKITEMID'
},
{
name: 'ALERTID',
mapping: 'ALERTID'
},
]
});
var storeMain = Ext.create('Ext.data.Store', {
model: 'Model',
autoLoad: false,
buffered: false,
pageSize: 5,
data: [],
proxy: {
type: 'pagingmemory',
reader: {
type: 'json',
root: 'user'
}
},
remoteSort: true,
remoteFilter: true,
remoteGroup: true
});
var sm = Ext.create('Ext.selection.CheckboxModel', {
listeners: {
selectionchange: function(sm, selections) {
selectedItems = selections;
}
}
});
var myGrid = new Ext.grid.Panel({
title: 'Unassign Alerts',
collapsible: false,
border: true,
loadMask: true,
frame: false,
id: 'myGridId',
columnLines: true,
animCollapse: false,
loadMask: true,
stripeRows: true,
renderTo: Ext.getBody(),
store: storeMain,
selModel: sm,
columns: [
{
text: 'Alert ID',
dataIndex: 'WORKITEMID',
flex: 8 / 100
}
],
listeners: {
'afterrender': function(e) {
var gridthWidth = this.getWidth();
this.setWidth(gridthWidth);
this.setAutoScroll(true);
},
'columnresize': function(e) {
var gridthWidth = this.getWidth();
this.setWidth(gridthWidth);
this.setAutoScroll(true);
},
cellclick: function(iView, iCellEl, iColIdx, iRecord, iRowEl, iRowIdx, iEvent) {
if (iColIdx == 1) {
selectedRecord = iRecord;
}
},
render: function(e) {
this.store.getProxy().data = Ext.decode(data);
//this.store.pageSize =25;
this.store.load();
this.store.on('load', function() {
//myMask.hide();
});
e.style = " background-color: #003464;";
}
},
bbar: new Ext.PagingToolbar({
store: storeMain,
id: 'Ptoolbar',
pageSize: 5,
displayInfo: true,
height: 25,
//plugins: Ext.create('Ext.ux.ProgressBarPager', {}),
displayMsg: 'Displaying Records {0} - {1} of {2}',
emptyMsg: "No records to display",
listeners: {
afterrender: function() {
this.child('#refresh').hide();
}
},
buttons: [{
id: 'btnID',
itemId: 'saveBtn',
pressed: true,
frame: true,
text: 'Remove',
handler: function(store) {
if (selectedItems.length > 0) {
store.remove(selectedItems);
Ext.getCmp('clientSummaryGridId').getView().refresh();
} else {
Ext.Msg.alert("Result", "No selection");
}
}
}]
})
});
});
</script>
If
Ext.getCmp('myGrid').getView().Refresh();
is not working you can also try
Ext.getCmp('myGrid').reconfigure(gridstore);
So whenever the record is removed from the grid, you could use this statement.

ExtJs - populating data from database to grid using actioncolumn

I have a grid with actionColumn and when I click on edit icon it should call the other form(already available) with data populated in to fields from database so that the user can edit and save it. I am new to Extjs please help
I tried with the following code but its not working:
myForm.getForm().load({
url: '/.RetrieveRecords',
params: { id: id},
method: 'POST',
waitMsg: 'Loading data...'
Here is my form1:
Ext.application({
name : 'extjs.com',
launch : function()
{
var myForm = Ext.create('Ext.form.Panel',
{
title: 'Registration Form',
id: 'form',
Layout: 'border',
border: 'true',
padding: 10,
bodyPadding: 30,
renderTo: Ext.getBody(),
defaultType: 'textfield',
items :
[
{fieldLabel: 'First Name', name: 'firstname', id: 'firstname',allowBlank: false, minLength: 2, maxLength:25, regex:/^[a-zA-Z]/},
{fieldLabel: 'Last Name', name: 'lastname', id: 'lastname', allowBlank: false, minLength: 2, maxLength:25},
{fieldLabel: 'Email', name: 'email', id: 'email',allowBlank: false, vType: 'email', msgTarget:'under'},
{fieldLabel: 'Mobile Number', name: 'mobilenumber', id: 'mobilenumber',allowBlank: false, minLength: 10, maxLength:10, regex:/^[7-9][0-9]{9}$/, regexText:"Invalid mobile number",msgTarget:"under"},
{
xtype: 'datefield',
fieldLabel: 'DOB'+'<span style="color:red;font-weight:bold" data-qtip="Required">*</span>',
name: 'dob',
id:'dob',
allowBlank: false,
value: '2 4 1978',
format: 'd m Y',
// value: new Date(),
maxValue: new Date(),
msgTarget:'side'
},
{
xtype:'radiogroup',
fieldLabel: 'Gender',
defaultType: 'radiofield',
anchor: '22.5%',
id:'gender1',
defaults:
{
flex: 1
},
layout: 'hbox',
items: [
{
boxLabel: 'Male',
name: 'rb',
inputValue: 'M',
checked: true
},
{
boxLabel: 'Female',
name: 'rb',
inputValue: 'F',
}]
},
{
xtype:'checkboxgroup',
fieldLabel: 'Known Technologies',
anchor: '50%',
id:'tech',
columns: 3,
vertical: true,
items:
[
{boxLabel: 'java', name: 'cb',inputValue: 'java', x:20, checked: true},
{boxLabel: 'c++', name: 'cb',inputValue: 'c++', x:20, checked: true},
{boxLabel: 'jsp', name: 'cb',inputValue: 'jsp', x:20, checked: false},
{boxLabel: 'javascript', name: 'cb',inputValue: 'javascript', checked: false},
{boxLabel: 'hadoop', name: 'cb',inputValue: 'hadoop', checked: false},
{boxLabel: 'spring', name: 'cb',inputValue: 'spring', checked: false}
]
},
{
xtype:'textarea',
fieldLabel: 'Hobbies',
name:'hobby',
id:'hobby',
anchor:'100%'
// padding:5
},
{
xtype:'fieldset',
title: 'Address',
collapsible:false,
items:
[
{
xtype:'combobox',
displayField:'cname',
valueField:'cid',
fieldLabel:'country'+'<span style =color:red;data-qtip="Required">*</span>',
queryMode:'local',
msgTarget: 'under',
name:'country',
id: 'country',
store: Ext.create('Ext.data.Store',{
fields:['cid','cname']
}),
listeners:
{
afterrender:function()
{
Ext.Ajax.request({
url:'./getRecords',
success: function(response)
{
var jarray = [];
jarray = Ext.JSON.decode(response.responseText);
Ext.getCmp('country').getStore().loadData(jarray);
},
failure: function(response)
{
Ext.Msg.alert('failed' + response.status);
}
});
},
change: function(a,b,c)
{
var countryID1 = Ext.getCmp('country').getValue();
Ext.Ajax.request({
url:'./getStates',
params:{countryID:countryID1},
success: function(response)
{
//alert(JSON.stringify(response));
var jarray = [];
jarray=Ext.JSON.decode(response.responseText);
Ext.getCmp('state').getStore().loadData(jarray);
},
failure: function(response)
{
Ext.Msg.alert('Failed' + response.status);
}
});
}
}
},
{
xtype:'combobox',
displayField:'sname',
valueField:'sid',
fieldLabel:'State',
name:'state',
id:'state',
queryMode:'local',
msgTarget: 'under',
store: Ext.create('Ext.data.Store',{
fields:['sid','sname']
}),
listeners:
{
change: function(a,b,c)
{
var StateID = Ext.getCmp('state').getValue();
Ext.Ajax.request({
url:'./getCities',
params: {StateID1:StateID},
success: function(response)
{
var jarray = [];
jarray = Ext.JSON.decode(response.responseText);
Ext.getCmp('city').getStore().loadData(jarray);
},
failure: function(response)
{
Ext.Msg.alert('failed' + response.status);
}
});
}
}
},
{
xtype:'combobox',
displayField:'cname',
valueField:'cid',
fieldLabel:'City',
name:'city',
id:'city',
queryMode:'local',
msgTarget: 'under',
store: Ext.create('Ext.data.Store',{
fields:['cid','cname','sid']
})
},
{
xtype:'textfield',
displayField:'PincodeName',
valueField:'pincodeID',
fieldLabel:'Pin-code',
id:'pincode',
allowBlank: false,
maskRe: /[0-9\-]/,
regex: /^[0-9]{3}(\-)?[0-9]{3}$/,
regexText:"invalid pincode",
msgTarget: 'under'
}
]
},
{
xtype:'fieldset',
title:'Education',
collasible: false,
items:
[
{
xtype:'combobox',
displayField:'QualificationName',
valueField:'QualificationID',
fieldLabel:'Qualification',
id:'qualification',
name:'qualification',
queryMode:'local',
msgTarget:'side',
store: Ext.create('Ext.data.Store',{
fields:['QualificationID','QualificationName'],
data:
[
{"QualificationID":"1","QualificationName":"B.Tech"},
{"QualificationID":"2","QualificationName":"Diploma"},
{"QualificationID":"3","QualificationName":"Advanced Diploma"}
]
}),
listeners:
{
change: function()
{
Ext.getCmp('DepartmentID').setVisible(true);
Ext.getCmp('PercentageID').setVisible(true);
}
}
},
{
xtype:'textfield',
name:'department',
id:'DepartmentID',
displayField:'Department',
valueField:'DeptID',
fieldLabel:'Department',
allowBlank: false,
hidden:true,
msgTarget: 'under'
},
{
xtype:'textfield',
name: 'percentage',
id: 'PercentageID',
displayField:'Percentage',
valueField:'PercentageID',
fieldLabel:'Percentage',
msgTarget: 'under',
regex:/^-?[0-9]{0,2}(\.[0-9]{1,2})?%?$|^-?(100)(\.[0]{1,2})?%?$/,
regexText:"invalid percentage",
hidden:true
}
]
}
],
buttons:
[
{text:'Submit',
handler: function()
{
var mail = Ext.getCmp('email').getValue();
var mnumber = Ext.getCmp('mobilenumber').getValue();
var gender = Ext.getCmp('gender1').getChecked()[0].inputValue;
var selection = [];
selection = Ext.getCmp('tech').getChecked();
var selections = "";
for(var i=0;i<selection.length;i++)
{
selections += selection[i].inputValue + " ";
}
var add = Ext.getCmp('country').getRawValue()+","+Ext.getCmp('state').getRawValue()+","+Ext.getCmp('city').getRawValue()+","+Ext.getCmp('pincode').getValue();
var edu = Ext.getCmp('qualification').getRawValue()+","+Ext.getCmp('DepartmentID').getValue()+","+Ext.getCmp('PercentageID').getValue();
var dob = Ext.getCmp('dob').getRawValue();
var hobby = Ext.getCmp('hobby').getValue();
var fname = Ext.getCmp('firstname').getValue();
var lname = Ext.getCmp('lastname').getValue();
//alert(this.up('form'));
var form = this.up('form').getForm();
if(form.isValid())
{
Ext.Ajax.request
({
url:'./Save_Records',
method: 'POST',
params: {mail1:mail,mnumber1:mnumber,gender2:gender,selections1:selections,add1:add,edu1:edu,dob1:dob,hobby1:hobby,fname1:fname,lname1:lname},
success: function(response)
{
Ext.Msg.alert("success" + response.status);
},
failure: function(response)
{
Ext.Msg.alert("failed" + response.status);
}
});
}
else
{
alert("Please fill in the form");
}
}
},
{
text:'Reset',
handler: function()
{
this.up('form').getForm().reset();
Ext.Ajax.request
({
url:'index.jsp',
method: 'POST',
success: function(response)
{
Ext.Msg.alert('Success' + " " + response.status);
},
failure: function(response)
{
Ext.Msg.alert('Failure' + " " + response.status);
}
});
}
}
]
});
}
});
Here is my Form2 with Actioncolumns:
Ext.onReady(function()
{
var store=Ext.create('Ext.data.Store',
{
autoload: true,
autosync: true,
data: [],
fields:
[
{name: 'firstname', id:'firstname'},
{name: 'email', id:'email'},
{name: 'mobileno', id:'mobileno'}
]
});
Ext.create('Ext.grid.Panel',
{
renderTo: Ext.getBody(),
height:150,
width:400,
x:200,
y:50,
store:store,
id: 'grid1',
columns:
[
{
header:'Firstname',
id:'firstname',
dataIndex:'firstname',
editor: {
xtype: 'textarea'
}
},
{
header:'Mobileno',
id:'mobileno',
dataIndex:'mobileno',
editor: {
xtype: 'textarea'
}
},
{
header:'Email',
id:'email',
dataIndex:'email',
editor: {
xtype: 'textarea'
}
},
{
header:'Action',
id:'action',
align:'center',
xtype:'actioncolumn',
sortable:false,
items:
[
{
icon:'images/view_icon.gif',
tooltip:'View',
handler: function(grid,rowIndex,colIndex)
{
var rec= grid.getStore().getAt(rowIndex);
}
},
{
icon:'images/edit_icon.gif',
tooltip:'Edit',
handler: function(grid,rowIndex,colIndex,e)
{
var rec= grid.getStore().getAt(rowIndex);
myForm.getForm().load({
// url: '/path/to/form/data',
params: { id: id},
method: 'POST',
waitMsg: 'Loading data...'
});
// Ext.Ajax.request(
// {
// url:'./RetrieveRecords',
// success: function(response)
// {
// Ext.Msg.alert("success" +" " + response.status);
// window.location.reload();
// },
// failure: function(response)
// {
// Ext.Msg.alert("failed" + response.status);
// }
// });
}
},
{
icon:'images/icons/cancel.png',
tooltip:'Delete',
handler: function(grid,rowIndex,colIndex)
{
var rec= grid.getStore().getAt(rowIndex);
var email = rec.get('email');
Ext.Ajax.request(
{
url:'./deleteRecords',
params:{email:email},
success: function(response)
{
Ext.Msg.alert("successfully deleted" +" " + response.status);
window.location.reload();
},
failure: function(response)
{
Ext.Msg.alert("failed" + response.status);
}
});
}
}
]
}
],
selType: 'cellmodel',
plugins:
[
Ext.create('Ext.grid.plugin.CellEditing',
{
clicksToEdit: 1
})
],
listeners:
{
afterrender:function()
{
Ext.Ajax.request(
{
params:{email:email},
url:'./RetrieveRecords',
success: function(response)
{
data = [];
data = Ext.JSON.decode(response.responseText);
Ext.getCmp('grid1').getStore().loadData(data);
},
failure: function(response)
{
Ext.Msg.alert("failure" + " " + response.status);
}
});
}
}
});
});
Try following as edit button:
handler: function(grid, rowIndex, colIndex, e) {
var rec = grid.getStore().getAt(rowIndex);
myForm.loadRecord(rec);
}

submit form on ENTER press int EXT js

i am very new to EXT.js; i need to submit the form when ENTER is pressed below is my code but i dont know what to call in the listener of the password field here is my code:
ie:what is the function to call in the listener
<script type="text/javascript">
Ext.onReady(function() {
Ext.tip.QuickTipManager.init();
Ext.create("Ext.container.Viewport", {
layout: "border",
rtl: <spring:theme code='theme.rtl' text='false' />
});
Ext.create("Ext.window.Window", {
title: "<spring:message code='title.login' text='Login' />",
height: 310,
width: 450,
closable: false,
layout: "border",
items: [{
xtype: "panel",
border: false,
bodyCls: "login-header",
height: 160,
region: "north"
}, {
id: "<%=loginFormId%>",
url: "<spring:url value='/secure/auth'/>",
xtype: "form",
layout: "form",
region: "center",
bodyPadding: 10,
border: false,
buttons: [{
handler: function() {
var form = this.up("form").getForm();
if (form.isValid()) {
Ext.getCmp("<%=submitBtnId%>").disable();
form.standardSubmit = true;
form.method = "POST";
form.submit();
}
},
id: "<%=submitBtnId%>",
text: "<spring:message code='button.submit' text='Submit' />"
}, {
handler: function() {
var form = this.up("form").getForm();
form.reset();
},
id: "<%=clearBtnId%>",
text: "<spring:message code='button.clear' text='Clear' />"
}],
defaultType: "textfield",
defaults: {
msgTarget: "side",
labelWidth: 100
},
items: [{
fieldLabel: "<spring:message code='input.username' text='Username' />",
name: "selfcare_username"
}, {
fieldLabel: "<spring:message code='input.password' text='Password' />",
name: "selfcare_password",
enableKeyEvents:true,
inputType: "password",
listeners: {
scope: this,
specialkey: function(f, e) {
if (e.getKey() === e.ENTER) {
}
}
}
}]
}]
}).show();
<c:if test="${not empty param.error}">
var errorMsg = "<c:out value="${SPRING_SECURITY_LAST_EXCEPTION.message}" />";
if (errorMsg !== "") {
Ext.MessageBox.show({
title: "<spring:message code='title.error' text='Error' />",
msg: errorMsg,
closable: false,
buttons: Ext.Msg.OK
});
}
</c:if>
});
</script>
These days it is better to use the defaultButton property on the form to designate the default button on the form. This is the button who's handler will handle your ENTER key.:
http://docs.sencha.com/extjs/6.0/6.0.2-classic/#!/api/Ext.panel.Panel-cfg-defaultButton
You should attach key event of the components listener, here is the sample which is working if the field not empty and pressed key ENTER or TAB inside the field.
suppliers is a JsonStore where I am loading store by params which means you can call whatever you wrote in the app.
{
xtype: 'textfield',
id: 'supplier-id',
flex: 1,
tabIndex: 1,
fieldLabel: 'SUPPLIER NO',
fieldStyle: 'text-align: right; font-size: 12pt',
margins: '0 5 0 0',
enablekeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (field.getValue() != 'null') {
if (e.getKey() === e.ENTER || e.TAB) {
suppliers.load({
params: {'supplier': field.getValue(), 'type': 'supplier'},
callback: function () {
Ext.getCmp('supplier-name').setValue(suppliers.data.items[0].data['MATCH_NAME']);
}
});
}
}
},
focus: function (e) {
e.setValue('');
Ext.getCmp('supplier-name').setValue("");
suppliers.loadData([], false);
}
}
}
For Sencha:
listeners: {
specialkey: function(field, e){
if (e.getKey() == e.ENTER) {
//submitLogin();
}
}
},
Add listener with afterrender
listeners: {
afterRender: function(thisForm, options){
this.keyNav = Ext.create('Ext.util.KeyNav', this.el, {
enter: fnLogin,//give here to login function
scope: this
});
}
}

How to create a field class containing an image in Ext JS 4?

i'm creating an application in Ext JS 4 and i'm stuck because i need a class containing an image to use into a form or a fieldset (like a regular textfield); moreover the image will change depending on the value passed to the form.
Something like an imagefield:
Ext.define('Properties', {
extend : 'Ext.form.Panel',
alias : 'properties',
bodyPadding: 5,
// The fields
defaultType: 'textfield',
items: [{
fieldLabel: 'Device Name',
name: 'deviceName'
},
{
xtype:'imagefield',
fieldLabel: 'Status',
name: 'status'
}
],.......
I've tried to extend Ext.form.field.Base without any success.
Somebody can help me ?
Thank you.
There is Ext.Image class you can use. But you probably would need to wrap it into some kind of border and add logic to load specific image in a run-time. If you want I can post some code later today.
Update: I did something like that:
Ext.define('QP.view.base.ImageContainer', {
extend: 'Ext.container.Container',
alias: 'widget.baseimagecontainer',
NO_IMAGE_FILE: 'resources/images/no_image.png',
DOWNLOAD_URL: '/Image/',
UPLOAD_URL: '/UploadImage',
CLEAR_URL: '/ClearImage/',
width: 205,
layout: 'hbox',
initComponent: function() {
var me = this;
Ext.apply(me, {
items: [{
xtype: 'fieldset',
itemId: 'imageWrapper',
title: 'Image',
width: 122,
height: 140,
margin: '0 0 0 0',
layout: 'anchor',
items: [{
xtype: 'image',
itemId: 'image',
maxWidth: 100,
maxHeight: 100
}]
}, {
xtype: 'container',
margin: '4 0 0 5',
layout: 'anchor',
defaults: {
xtype: 'button',
width: 70,
margin: '0 0 5 0'
},
items: [{
itemId: 'clearButton',
text: 'Clear',
handler: function() {
me.clearImage();
}
}, {
xtype: 'fileuploadfield',
buttonOnly: true,
hideLabel: true,
itemId: 'uploadButton',
buttonText: 'Upload...',
buttonConfig: { width: 70 },
listeners: {
change: function(el, val) {
// this.up('window').fireEvent('uploadimage', fb, v);
me.uploadImage(el, val);
}
}
}, {
itemId: 'fullResButton',
text: 'Download',
handler: function() {
window.open(me.fullImagePath);
}
}]
}]
});
me.callParent(arguments);
},
success: function() {
var me = this,
fs = me.down('[itemId=imageWrapper]'),
b1 = me.down('[itemId=clearButton]'),
b2 = me.down('[itemId=fullResButton]');
fs.enable();
b1.enable();
b2.enable();
},
loadImage: function(recordId) {
var me = this,
fs = me.down('[itemId=imageWrapper]'),
b1 = me.down('[itemId=fullResButton]'),
b2 = me.down('[itemId=clearButton]'),
img = me.down('image');
me.fullImagePath = me.DOWNLOAD_URL + '/' +recordId;
me.imageRecordId = recordId;
fs.disable();
b1.disable();
b2.disable();
img.getEl().on('load', me.success, me, { single: true });
img.getEl().on('error', function() {
img.getEl().un('load', me.success, me);
img.setSrc(me.NO_IMAGE_FILE);
fs.enable();
}, me, { single: true });
img.setSrc(me.DOWNLOAD_URL + '/' +recordId);
},
uploadImage: function(el, val) {
var me = this,
fm = Ext.create('Ext.form.Panel', {
items: [ el ]
}),
f = fm.getForm();
f.submit({
method: 'POST',
params: {
recordId: me.imageRecordId
},
url: me.UPLOAD_URL,
waitMsg: 'Uploading your image...',
success: function(fp, o) {
me.loadImage(me.imageLocation, me.imageRecordId);
},
failure: function(fp, o) {
console.log('upload failed', fp, o);
}
});
},
clearImage: function() {
var me = this;
QP.util.Msg.askConfirmation('Are you sure you want to delete an image?', function() {
Ext.Ajax.request({
method: 'GET',
url: me.CLEAR_URL + me.imageLocation + '/' + me.imageRecordId,
success: function(fp, o) { me.loadImage(me.imageLocation, me.imageRecordId); },
failure: function(fp, o) { console.log('upload failed', fp, o); }
});
}, me);
}
});

Resources