source upload
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
Ext.require([
|
||||
'Ext.util.*'
|
||||
]);
|
||||
|
||||
Ext.define('ExtMVC.view.contact.Edit', {
|
||||
extend : 'Ext.window.Window',
|
||||
alias : 'widget.contactform',
|
||||
id: 'contactform',
|
||||
autoShow : true,
|
||||
height : 168,
|
||||
width : 398,
|
||||
layout : {
|
||||
type : 'fit'
|
||||
},
|
||||
iconCls : 'icon-user',
|
||||
title : 'Create/Edit SampleRecord',
|
||||
initComponent : function () {
|
||||
var me = this;
|
||||
|
||||
Ext.applyIf(me, {
|
||||
items : [{
|
||||
xtype : 'form',
|
||||
style : 'background-color: #fff;',
|
||||
bodyPadding : 10,
|
||||
items : [{
|
||||
xtype : 'hiddenfield',
|
||||
anchor : '100%',
|
||||
name : 'ID',
|
||||
fieldLabel : 'Label'
|
||||
}, {
|
||||
xtype : 'textfield',
|
||||
anchor : '100%',
|
||||
id : 'FnameE',
|
||||
name : 'Name',
|
||||
fieldLabel : 'Name',
|
||||
msgTarget : 'side',
|
||||
allowBlank : false,
|
||||
maxLength : 255
|
||||
}, {
|
||||
xtype : 'datefield',
|
||||
anchor : '100%',
|
||||
id : 'FtimeE',
|
||||
name : 'TimeD',
|
||||
fieldLabel : 'Date',
|
||||
msgTarget : 'side',
|
||||
allowBlank : false,
|
||||
format : 'Y-m-d',
|
||||
altformat: 'Y-m-d H:i',
|
||||
maxLength : 255
|
||||
}, {
|
||||
xtype : 'textfield',
|
||||
anchor : '100%',
|
||||
id : 'FquestionE',
|
||||
name : 'Question',
|
||||
fieldLabel : 'Question',
|
||||
msgTarget : 'side',
|
||||
allowBlank : false,
|
||||
maxLength : 255
|
||||
}
|
||||
],
|
||||
dockedItems : [{
|
||||
xtype : 'toolbar',
|
||||
dock : 'bottom',
|
||||
items : [{
|
||||
xtype : 'tbfill'
|
||||
}, {
|
||||
xtype : 'button',
|
||||
action : 'cancel',
|
||||
iconCls : 'icon-reset',
|
||||
text : 'Cancel'
|
||||
}, {
|
||||
xtype : 'button',
|
||||
action : 'save',
|
||||
formBind : true,
|
||||
iconCls : 'icon-save',
|
||||
text : 'Update'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
});
|
||||
me.callParent(arguments);
|
||||
}
|
||||
});
|
@@ -0,0 +1,69 @@
|
||||
Ext.define('ExtMVC.view.contact.Filtro', {
|
||||
extend : 'Ext.window.Window',
|
||||
alias : 'widget.contatofiltro',
|
||||
autoShow : true,
|
||||
height : 168,
|
||||
width : 398,
|
||||
layout : {
|
||||
type : 'fit'
|
||||
},
|
||||
iconCls : 'icon-user',
|
||||
title : 'Filtrar/Buscar Contatos',
|
||||
initComponent : function () {
|
||||
var me = this;
|
||||
|
||||
Ext.applyIf(me, {
|
||||
items : [{
|
||||
xtype : 'form',
|
||||
style : 'background-color: #fff;',
|
||||
bodyPadding : 10,
|
||||
items : [{
|
||||
xtype : 'hiddenfield',
|
||||
anchor : '100%',
|
||||
name : 'ID',
|
||||
fieldLabel : 'Label'
|
||||
}, {
|
||||
xtype : 'textfield',
|
||||
anchor : '100%',
|
||||
id : 'Fname',
|
||||
name : 'Name',
|
||||
fieldLabel : 'Name',
|
||||
msgTarget : 'side',
|
||||
allowBlank : false,
|
||||
maxLength : 255
|
||||
}, {
|
||||
xtype : 'datefield',
|
||||
anchor : '100%',
|
||||
id : 'Ftime',
|
||||
name : 'TimeD',
|
||||
fieldLabel : 'Time',
|
||||
msgTarget : 'side',
|
||||
allowBlank : false,
|
||||
format : 'd-m-Y',
|
||||
maxLength : 255
|
||||
}
|
||||
],
|
||||
dockedItems : [{
|
||||
xtype : 'toolbar',
|
||||
dock : 'bottom',
|
||||
items : [{
|
||||
xtype : 'tbfill'
|
||||
}, {
|
||||
xtype : 'button',
|
||||
action : 'reset',
|
||||
text : 'Reset Filter'
|
||||
}, {
|
||||
xtype : 'button',
|
||||
action : 'filtrar_busca',
|
||||
formBind : true,
|
||||
text : 'Filter'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
});
|
||||
me.callParent(arguments);
|
||||
}
|
||||
});
|
@@ -0,0 +1,95 @@
|
||||
Ext.apply(Ext.form.field.VTypes, {
|
||||
daterange : function (val, field) {
|
||||
var date = field.parseDate(val);
|
||||
if (!date) {
|
||||
return false;
|
||||
}
|
||||
if (field.startDateField && (!this.dateRangeMax || (date.getTime() != this.dateRangeMax.getTime()))) {
|
||||
var start = field.up('form').down('#' + field.startDateField);
|
||||
start.setMaxValue(date);
|
||||
start.validate();
|
||||
this.dateRangeMax = date;
|
||||
} else if (field.endDateField && (!this.dateRangeMin || (date.getTime() != this.dateRangeMin.getTime()))) {
|
||||
var end = field.up('form').down('#' + field.endDateField);
|
||||
end.setMinValue(date);
|
||||
end.validate();
|
||||
this.dateRangeMin = date;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
daterangeText : 'Start date must be before end date'
|
||||
});
|
||||
|
||||
Ext.tip.QuickTipManager.init();
|
||||
Ext.define('ExtMVC.view.contact.Filtrod', {
|
||||
extend : 'Ext.form.Panel',
|
||||
alias : 'widget.contatofiltrod',
|
||||
autoShow : true,
|
||||
renderTo : 'dr',
|
||||
height : 160,
|
||||
width : 400,
|
||||
padding : 10,
|
||||
layout : {
|
||||
type : 'fit'
|
||||
},
|
||||
iconCls : 'icon-user',
|
||||
title : '<h1>Filtering Date Range</h1>',
|
||||
|
||||
initComponent : function () {
|
||||
var me = this;
|
||||
Ext.applyIf(me, {
|
||||
items : [{
|
||||
xtype : 'form',
|
||||
style : 'background-color: #fff;',
|
||||
bodyPadding : 10,
|
||||
items : [{
|
||||
xtype : 'datefield',
|
||||
fieldLabel : 'Start Date',
|
||||
name : 'startdt',
|
||||
itemId : 'startdt',
|
||||
format : 'd-m-Y',
|
||||
id : 'startdt',
|
||||
vtype : 'daterange',
|
||||
endDateField : 'enddt' // id of the end date field
|
||||
}, {
|
||||
xtype : 'datefield',
|
||||
fieldLabel : 'End Date',
|
||||
name : 'enddt',
|
||||
itemId : 'enddt',
|
||||
format : 'd-m-Y',
|
||||
id : 'enddt',
|
||||
vtype : 'daterange',
|
||||
startDateField : 'startdt' // id of the start date field
|
||||
}
|
||||
],
|
||||
dockedItems : [{
|
||||
xtype : 'toolbar',
|
||||
dock : 'bottom',
|
||||
items : [{
|
||||
xtype : 'tbfill'
|
||||
}, {
|
||||
xtype : 'button',
|
||||
action : 'resetd',
|
||||
iconCls : 'icon-default',
|
||||
text : 'Reset Filter'
|
||||
}, {
|
||||
xtype : 'button',
|
||||
action : 'filtrar_buscad',
|
||||
formBind : true,
|
||||
iconCls : 'icon-filter',
|
||||
text : 'Filter'
|
||||
}, {
|
||||
xtype : 'button',
|
||||
action : 'deleterange',
|
||||
iconCls : 'icon-delete',
|
||||
text : 'Delete Date Range'
|
||||
},
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
});
|
||||
me.callParent(arguments);
|
||||
}
|
||||
});
|
@@ -0,0 +1,117 @@
|
||||
Ext.define('RemoteCountrySearch', {
|
||||
extend : 'Ext.form.ComboBox',
|
||||
alias : 'widget.remoteCountrySearch',
|
||||
queryMode : 'remote',
|
||||
displayField : 'Name',
|
||||
valueField : 'ID',
|
||||
forceSelection : true,
|
||||
id : 'countryBox',
|
||||
style : 'font-size: medium; color: blue;',
|
||||
fieldStyle : 'font-size: medium; color: red; heigth: 50px;',
|
||||
labelWidth : 80,
|
||||
fieldLabel : 'Select a Name',
|
||||
size : 50,
|
||||
maxLength : 50,
|
||||
allowBlank : true,
|
||||
name : 'remoteCountry',
|
||||
store : 'Contacts',
|
||||
minChars : 2,
|
||||
hideTrigger : true,
|
||||
triggerAction : 'All',
|
||||
typeAhead : false,
|
||||
listeners : {
|
||||
'beforequery' : function (queryEvent, options) {
|
||||
this.store.loadPage(1);
|
||||
this.store.remoteFilter = false;
|
||||
this.store.clearFilter();
|
||||
this.store.remoteFilter = true;
|
||||
this.store.getProxy().extraParams = {
|
||||
where : 'Name like :("' + queryEvent.query + '%"):'
|
||||
};
|
||||
this.store.load();
|
||||
},'keyup': function() {/*TODO*/}
|
||||
}
|
||||
});
|
||||
|
||||
Ext.define('ExtMVC.view.contact.Grid', {
|
||||
extend : 'Ext.grid.Panel',
|
||||
alias : 'widget.contactgrid',
|
||||
renderTo : 'warleyalex',
|
||||
padding : 10,
|
||||
id : 'mygrid',
|
||||
iconCls : 'icon-grid',
|
||||
title : 'Using mORMot with ExtJS >> by warleyalex',
|
||||
store : 'Contacts',
|
||||
initComponent : function () {
|
||||
var me = this;
|
||||
|
||||
Ext.applyIf(me, {
|
||||
columns : [{
|
||||
xtype : 'gridcolumn',
|
||||
text : "id",
|
||||
width : 10,
|
||||
dataIndex : 'ID',
|
||||
sortable : true,
|
||||
hidden : true
|
||||
}, {
|
||||
xtype : 'gridcolumn',
|
||||
width : 50,
|
||||
dataIndex : 'Name',
|
||||
flex : 1,
|
||||
text : 'Name'
|
||||
}, {
|
||||
xtype : 'gridcolumn',
|
||||
width : 10,
|
||||
dataIndex : 'TimeD',
|
||||
flex : 1,
|
||||
text : 'Date'
|
||||
}, {
|
||||
xtype : 'gridcolumn',
|
||||
width : 50,
|
||||
dataIndex : 'Question',
|
||||
flex : 1,
|
||||
text : 'Question'
|
||||
}
|
||||
],
|
||||
viewConfig : {
|
||||
emptyText : 'no records found'
|
||||
},
|
||||
dockedItems : [{
|
||||
xtype : 'toolbar',
|
||||
dock : 'top',
|
||||
items : [{
|
||||
xtype : 'button',
|
||||
action : 'add',
|
||||
iconCls : 'icon-save',
|
||||
text : 'Add'
|
||||
}, {
|
||||
xtype : 'button',
|
||||
action : 'delete',
|
||||
iconCls : 'icon-delete',
|
||||
text : 'Delete'
|
||||
}, {
|
||||
xtype : 'button',
|
||||
action : 'filtrar',
|
||||
iconCls : 'icon-search',
|
||||
text : 'Full Search'
|
||||
}, {
|
||||
xtype : 'button',
|
||||
action : 'filtrar_name',
|
||||
text : 'Date Range'
|
||||
}, {
|
||||
xtype : 'remoteCountrySearch'
|
||||
}
|
||||
]
|
||||
}, {
|
||||
xtype : 'pagingtoolbar',
|
||||
dock : 'bottom',
|
||||
width : 1004,
|
||||
displayInfo : true,
|
||||
emptyMsg : 'No contact to display',
|
||||
store : 'Contacts'
|
||||
}
|
||||
]
|
||||
});
|
||||
me.callParent(arguments);
|
||||
}
|
||||
});
|
Reference in New Issue
Block a user