i want to save data (result) but three fields with the same name. when one is enabled others are disabled. it works for me. but the problem is that when i edit it from grid, two ,, added with values......... [in extjs 4 mvc]
here is my view
Ext.define('Ext4Example.view.employee.Education' ,{
extend: 'Ext.window.Window',
alias : 'widget.education',
modal:true,
autoShow: true,
bodyPadding: 5,
initComponent: function () {
this.items = [
{
xtype: 'form',
id:'form',
bodyStyle: {
background: 'none',
padding: '10px',
border: '0'
},
items: [
{
xtype: 'fieldcontainer',
items: [
{
xtype: 'combobox',
fieldLabel: 'Result Type',
emptyText:'Select Result Type',
displayField:'type',
valueField:'id',
store: 'TypeStocks',
name: 'type',
id:'type',
width: 265,
allowBlank:false,
anchor:'95%',
listeners : {
'select': {
fn: function (combo, value) {
var value=combo.getValue();
if(value =='1'){
Ext.getCmp('cgpa').hide();
Ext.getCmp('jak').hide();
Ext.getCmp('sc').hide();
Ext.getCmp('range').hide();
Ext.getCmp('range').disable();
Ext.getCmp('cgpa').disable();
Ext.getCmp('division').enable();
Ext.getCmp('division').show();
}
else if(value =='2'){
Ext.getCmp('division').disable();
Ext.getCmp('division').hide();
Ext.getCmp('cgpa').enable();
Ext.getCmp('cgpa').show();
Ext.getCmp('jak').show();
Ext.getCmp('sc').show();
Ext.getCmp('range').enable();
Ext.getCmp('range').show();
}
}
}
}
},
{
xtype:'combobox',
fieldLabel: 'Division',
name: 'result',
emptyText:'Select Result',
store: Division,
id:'division',
width: 265,
anchor:'95%',
allowBlank:false
},
{
xtype:'fieldcontainer',
layout: 'hbox',
items:[
{
xtype:'label',
text:'Score',
hidden: true,
id:'sc'
},
{
xtype:'textfield',
name: 'result',
hidden: true,
width: 68,
margin:'0 0 0 75',
id:'cgpa',
anchor:'95%',
emptyText:'Score',
vtype : 'radius',
allowBlank:false
},
{
xtype:'textfield',
name: 'result',
hidden: true,
width: 68,
margin:'0 0 0 75',
id:'gpa',
anchor:'95%',
emptyText:'Score',
vtype : 'radiuss',
allowBlank:false
},
{
xtype:'label',
text:'of',
hidden: true,
margin:'0 5 0 5',
id:'jak'
},
{
xtype: 'combobox',
emptyText:'Range',
store: range,
name: 'range',
id: 'range',
margin:'0 5 0 5',
width: 65,
hidden: true,
anchor:'95%',
allowBlank:false,
listeners : {
'select': {
fn: function (combo, value) {
var value=combo.getValue();
if(value =='5.00'){
Ext.getCmp('outOf').setValue(1);
Ext.getCmp('cgpa').enable();
Ext.getCmp('cgpa').show();
Ext.getCmp('gpa').setValue('');
Ext.getCmp('gpa').disable();
Ext.getCmp('gpa').hide();
}
else if(value =='4.00'){
Ext.getCmp('outOf').setValue(0);
Ext.getCmp('gpa').enable();
Ext.getCmp('gpa').show();
Ext.getCmp('cgpa').setValue('');
Ext.getCmp('cgpa').disable();
Ext.getCmp('cgpa').hide();
}
}
}
}
}]
},
{
xtype: 'button',
text: 'SAVE',
iconCls: 'savee',
handler: function () {
var form = this.up('form').getForm(),
values = form.getValues();
var education = Ext.create('Ext4Example.model.EducationModel',values);
// if (form.isValid()) {
education.save({
success: function(education) {
var store = Ext.data.StoreManager.get('EducationStocks');
store = !store ? Ext.create("EducationStocks") : store;
store.load();
},
failure: function(education){
Ext.Msg.alert('Failed', 'Data already exits');
}
});
// }
}
},
{
xtype: 'button',
text: 'Cancel',
margin:'0 0 0 5',
scope: this,
handler: this.close
}]
}]
}];
this.callParent(arguments);
}
});
---------------
model
Ext.define('Ext4Example.model.EducationModel', {
extend: 'Ext.data.Model',
idProperty: 'id',
fields: [
{name: 'result', mapping:'result', type: 'string'} ,
{name: 'outOf', mapping:'outOf', type: 'int'}
],
proxy: {
type: 'ajax',
noCache: false,
api: {
create : '${createLink(controller:'education', action: 'create')}'
},
actionMethods: {
create : 'POST'
},
reader: {
type: 'json',
root: 'data',
totalProperty : 'total',
successProperty : 'success',
messageProperty : 'message',
implicitIncludes: true
},
writer: {
type: 'json',
root: 'data',
writeAllFields: true
},
simpleSortMode: true
},
belongsTo: [{model:'Ext4Example.model.ExamModel', name:'exams'}]
});
If two of more fields have the same name, when the form is submitted, the fields with the same name are clubbed together into an array and then submitted. So, if you check the parameter submitted to the server, they will be :
type : typeValue
result : [resultFromCombo, resultFromTextField1, resultFromTextField2]
range : rangeValue
So in the server, I think you are directly converting the result array into a string and saving it. On converting the result array to a string it will convert to resultFromCombo, resultFromTextField1, resultFromTextField2. Hence you are getting the 2 commas in your grid.
Related
I requires Ext.grid.plugin.Editable in my grid. Now I want to change classes inside default panel, witch slides right for editing of row.
But I don't understand how I to manage submit and delete button function (for example I want to define POST for submit button).
toolbarConfig - doesn't work
Ext.define('Foresto.model.EditListRenters', {
extend: 'Ext.grid.Grid',
xtype: 'rentlist',
requires: [ //some plugins and models
],
frame: true,
store: {
model: 'Foresto.model.RentsListModel',
autoLoad: true,
pageSize: 0,
proxy: {
type: 'ajax',
url: '/api/renter/',
reader: {
type: 'json',
rootProperty: 'results'
}
}
},
plugins: [{
type: //someplugins}
],
/* toolbarConfig: {
xtype:'titlebar',
docked:'top',
items:[{
xtype:'button', // it is don't work
ui:'decline',
text:'decline',
align: 'right',
action:'cancel'
}]
}, */
columns: [{
text: 'id',
dataIndex: 'id'
}, {
text: 'document',
dataIndex: 'document',
editable: true,
flex: 1
}, {
text: 'document_num',
dataIndex: 'document_num',
editable: true
}, {
text: 'legal_type',
dataIndex: 'legal_type',
editable: true
}, {
text: 'fio_represent',
dataIndex: 'fio_represent',
editable: true
}, {
text: 'position_represent',
dataIndex: 'position_represent',
editable: true,
}, {
text: 'certificate',
dataIndex: 'certificate',
editable: true,
}]
});
Here is an example of a grid with a custom form:
https://fiddle.sencha.com/#view/editor&fiddle/2ojt
// model
Ext.define('Fiddle.model.Document', {
extend: 'Ext.data.Model',
fields: [{
name: 'id',
type: 'int'
}, {
name: 'document',
type: 'string'
}, {
name: 'type',
type: 'string'
}]
});
//view (grid)
Ext.define('Fiddle.view.DocumentGrid', {
extend: 'Ext.grid.Panel',
xtype: 'documentlist',
store: {
model: 'Fiddle.model.Document',
data: [{
id: 1,
document: 'My First Doc',
type: 'pdf'
}, {
id: 2,
document: 'My Second Doc',
type: 'pdf'
}]
},
columns: [{
text: 'id',
dataIndex: 'id'
}, {
text: 'Document',
dataIndex: 'document',
flex: 1
}, {
text: 'Type',
dataIndex: 'type',
}]
});
var form = Ext.create('Ext.form.Panel', {
title: 'Form',
region: 'east',
layout: {
type: 'vbox',
algin: 'stretch'
},
collapsible: true,
bodyPadding: 10,
hidden: true,
items: [{
xtype: 'textfield',
name: 'document',
fieldLabel: 'Document'
}, {
xtype: 'combo',
name: 'type',
fieldLabel: 'type',
store: ['pdf', 'doc', 'docx', 'odf']
}],
buttons: [{
text: 'Save',
handler: function () {
form.updateRecord();
form.hide();
}
}]
});
var grid = Ext.create('Fiddle.view.DocumentGrid', {
title: 'Document Grid',
region: 'center',
listeners: {
selectionchange: function (selModel, selection) {
if (Ext.isEmpty(selection)) {
form.hide();
return;
}
form.loadRecord(selection[0]);
form.show();
}
}
});
Ext.application({
name: 'Fiddle',
launch: function () {
Ext.create('Ext.panel.Panel', {
renderTo: Ext.getBody(),
layout: 'fit',
layout: 'border',
width: 600,
height: 600,
items: [
grid, form
]
});
}
});
I have a simple Extjs (5.1.1) Tree menu:
var menu = new Ext.tree.Panel( {
root: {
text: 'My menu',
expanded: true,
listeners: {
itemclick: function(s,r) {
alert(r.data.text);
}
},
children: [{
text: 'System',
expanded: true,
children: [{
text: '',
leaf: true
}, {
text: 'System Users',
leaf: true
}, {
text: 'System Administrators',
leaf: true
}]
}, {
text: 'Settings',
expanded: true,
children: [{
text: 'Passwords',
leaf: true
}, {
text: 'Emails',
leaf: true
}, ]
}, {
text: 'Logs',
leaf: true,
}]
}
});
Ext.application({
name : 'MVC',
launch : function() {
Ext.create('Ext.container.Viewport', {
extend: 'Ext.container.Viewport',
layout: 'border',
items: [
{
title: 'North',
region: 'north',
height: 50,
xtype: 'container'
},
{
title: 'Menu',
region:'west',
floatable: false,
items: menu,
width: 300
},
{
title: 'Center',
region: 'center'
}
]
});
}
});
My problem: The contents (GRID) have some js file. And I would like click one of the tree menu than js load 'Center' item. But I don't know how. :-(
Example system_users.js file: (This file should load on center when I click System Users on the Tree.)
var Users = {
init: function () {
itemdblclick: this.editDocument
},
edit: function(grid, roWindex, e) {
var id = grid.getStore().getAt(rowIndex);
Users.openEditForm(id);
},
openEditForm: function(id){
// form open
}
};
Users.init();
Ext.application({
name : 'Users',
launch : function() {
Ext.widget({
renderTo : Ext.getBody(),
xtype : 'grid',
title : 'Users',
height : 800,
store : {
fields : [ 'login_id',
'login_name',
'login_firstname',
'login_middlename',
'login_lastname',
'login_email',
'login_mobile',
'login_status' ],
autoLoad : true,
proxy: {
type: 'ajax',
api: {
read: 'http://users/select',
create: 'http://users/insert',
update: 'http://users/update',
destroy: 'http://users/delete'
},
reader: {
type: 'json',
successProperty: 'success',
root: 'data',
messageProperty: 'message'
},
writer: {
type: 'json',
writeAllFields: false,
root: 'data'
}
}
},
columns: {
items: [
{ text: 'ID', dataIndex: 'login_id', editor: 'textfield', width: 200 },
{ text: 'Login Name', dataIndex: 'login_name', editor: 'textfield', width: 200 },
{ text: 'Firstname', dataIndex: 'login_firstname', editor: 'textfield', width: 200 },
{ text: 'Middlename', dataIndex: 'login_middlename', editor: 'textfield', width: 200 },
{ text: 'Lastname', dataIndex: 'login_lastname', editor: 'textfield', width: 200 },
{ text: 'Email', dataIndex: 'login_email', editor: 'textfield', width: 200 },
{ text: 'Mobile', dataIndex: 'login_mobile', editor: 'textfield', width: 200 },
{ text: 'Status', dataIndex: 'login_status', editor: 'textfield', width: 200 }
]
},
listeners: {
itemdblclick: function(dv, record, item, index, e) {
// This is row index
alert(index);
}
}
})
}
});
I am trying to add rows to my grid.
I saw an example in the docs:
onAddRouteClick: function(){
// Create a model instance
var rec = new KitchenSink.model.grid.Plant({
buying_vendor_id: 12,
country_code: '1',
route: 0
});
this.getStore().insert(0, rec);
this.cellEditing.startEditByPosition({
row: 0,
column: 0
});
}
But i cant seem to make it work in my code.
This is my grid:
onBtnRoutesSearchClick: function(button, e, options){
var me = this;
var v_url = 'GetRoutes.jsp?' + Ext.urlEncode({'route_id': routeID, 'route_country_code' : routeCountryCode , 'route_vendor_id' : routeVendorID});
var newTab = Ext.create('Ext.panel.Panel', {
id: 'routes_pannel',
title: 'Routes',
autoScroll: true,
layout: {
type: 'fit'
},
closable: true,
dockedItems: [
{
xtype: 'toolbar',
dock: 'top',
items: [
{
xtype: 'button',
id: 'buttonResetBid',
icon: 'images/Plus.png',
text: 'Add Row',
listeners: {
click: {
fn: me.onAddRouteClick,
scope: me
}
}
}
]
}
],
items: [{
id: 'routes_grid',
xtype: 'gridpanel',
autoShow: false,
autoScroll: true,
store: Ext.create('Ext.data.Store', {
fields:[
{name: 'buying_vendor_id', type: 'int', sortType: 'asInt'},
{name: 'country_code', type: 'int', sortType: 'asInt'},
{name: 'route', type: 'int', sortType: 'asInt'}
],
proxy: {
type: 'ajax',
timeout: 120000,
url: v_url,
reader: {
type: 'json',
root: 'data',
successProperty: 'success'
}
},
autoLoad: true
}),
columns: [
{
xtype: 'gridcolumn',
dataIndex: 'buying_vendor_id',
width: 100,
text: 'Buying Vendor'
},
{
xtype: 'gridcolumn',
dataIndex: 'country_code',
width: 100,
text: 'Country Code'
},
{
xtype: 'gridcolumn',
dataIndex: 'route',
width: 80,
text: 'Route'
}
],
}]
});
var panel = Ext.getCmp("MainTabPanelID");
panel.add(newTab).show();
}
Any ideas?
1.Create your model
Ext.define('Product', {
extend: 'Ext.data.Model',
fields: [
{name: 'ProductID'},
{name: 'ProductName'},
{name: 'UnitPrice'},
{name: 'UnitsInStock'}
]
});
2.create your rowEditing
var rEditor = Ext.create('Ext.grid.plugin.RowEditing', {
clicksToEdit: 2,
listeners: {edit: function (editor, e) { }); }
});
3.get Store and create your grid
var grid = Ext.create('Ext.grid.Panel', {
store: store,
plugins: [rEditor],
title: 'Products',
columns: [ ],
dockedItems: [ {
xtype: 'toolbar',
dock: 'top',
items: [ {
xtype: 'button',
text: 'Yeni',
listeners: {
click: {
fn: function () { store.insert(0, new Product()); rEditor.startEdit(0, 0); }
}
}
} ]
} ],
width: 450,
renderTo: Ext.getElementById('hede')
});
I am trying to add rows to my grid.
I saw an example in the docs:
onAddRouteClick: function(){
// Create a model instance
var rec = new KitchenSink.model.grid.Plant({
buying_vendor_id: 12,
country_code: '1',
route: 0
});
this.getStore().insert(0, rec);
this.cellEditing.startEditByPosition({
row: 0,
column: 0
});
}
this.getStore().insert(0, rec);
this.cellEditing.startEditByPosition({
row: 0,
column: 0
});
}
But i cant seem to make it work in my code.
This is my grid:
onBtnRoutesSearchClick: function(button, e, options){
var me = this;
var v_url = 'GetRoutes.jsp?' + Ext.urlEncode({'route_id': routeID, 'route_country_code' : routeCountryCode , 'route_vendor_id' : routeVendorID});
var newTab = Ext.create('Ext.panel.Panel', {
id: 'routes_pannel',
title: 'Routes',
autoScroll: true,
layout: {
type: 'fit'
},
closable: true,
dockedItems: [
{
xtype: 'toolbar',
dock: 'top',
items: [
{
xtype: 'button',
id: 'buttonResetBid',
icon: 'images/Plus.png',
text: 'Add Row',
listeners: {
click: {
fn: me.onAddRouteClick,
scope: me
}
}
}
]
}
],
items: [{
id: 'routes_grid',
xtype: 'gridpanel',
autoShow: false,
autoScroll: true,
store: Ext.create('Ext.data.Store', {
fields:[
{name: 'buying_vendor_id', type: 'int', sortType: 'asInt'},
{name: 'country_code', type: 'int', sortType: 'asInt'},
{name: 'route', type: 'int', sortType: 'asInt'}
],
proxy: {
type: 'ajax',
timeout: 120000,
url: v_url,
reader: {
type: 'json',
root: 'data',
successProperty: 'success'
}
},
autoLoad: true
}),
columns: [
{
xtype: 'gridcolumn',
dataIndex: 'buying_vendor_id',
width: 100,
text: 'Buying Vendor'
},
{
xtype: 'gridcolumn',
dataIndex: 'country_code',
width: 100,
text: 'Country Code'
},
{
xtype: 'gridcolumn',
dataIndex: 'route',
width: 80,
text: 'Route'
}
],
}]
});
var panel = Ext.getCmp("MainTabPanelID");
panel.add(newTab).show();
1.Create your model
Ext.define('Product', {
extend: 'Ext.data.Model',
fields:
[
{ name: 'ProductID' },
{ name: 'ProductName' },
{ name: 'UnitPrice' },
{ name: 'UnitsInStock' }
]
});
2.create your rowEditing
var rEditor = Ext.create('Ext.grid.plugin.RowEditing', {
clicksToEdit: 2,
listeners:
{
edit: function (editor, e) { });
}
});
3.get Store and create your grid
var grid = Ext.create('Ext.grid.Panel', {
store: store,
plugins: [rEditor],
title: 'Products',
columns:
[
],
dockedItems:
[
{
xtype: 'toolbar',
dock: 'top',
items:
[
{
xtype: 'button',
text: 'Yeni',
listeners:
{
click:
{
fn: function () {
store.insert(0, new Product());
rEditor.startEdit(0, 0);
}
}
}
}
]
}
],
width: 450,
renderTo: Ext.getElementById('hede')
});
So you are trying to add a record to store right?
OK, lets look at the Store API
http://docs.sencha.com/extjs/4.1.3/#!/api/Ext.data.Store-method-add
Sample usage:
myStore.add({some: 'data'}, {some: 'other data'});
The best practice is to also create a Model class . Read the component guides on grid and the data package .
I have a grid in which I want to filter some results. For filtering the result a popup is opened and the user can select the search criteria and filter the results. The php file is executed as well as the result is returned to the popup, but it is not displaying in the main grid. Here is my code.
This code displays the grid and is displaying the result when the user selects the radio button for filtering purpose :
var checkModel = new xg.CheckboxSelectionModel();
var orderGridPanel = {
id: 'orderGridPanel',
xtype: 'editorgrid',
title: 'Orders',
height:350,
clicksToEdit: 2,
frame: true,
viewConfig: {
forceFit:true
},
cm: new xg.ColumnModel({
defaults: {
width: 120,
sortable: true
},
columns: [
{header:"nr",dataIndex:'nr',hidden:true}
,checkModel
,{header:"Order Id",dataIndex:'order'}
,{header:"Order Date",dataIndex:'date', renderer:Ext.util.Format.dateRenderer('m/d/Y')}
,{id:'created_by',header:"Order By",dataIndex:'created',align:'left'}
,{id:'order_type',header:"Order Source",dataIndex:'order',align:'left'}
,{header:"Order Type", dataIndex:'category'}
,{header:"Sub Category",dataIndex:'sub_cate_nm'}
,{header:"Item",dataIndex:'item'}
,{header:"Properties",dataIndex:'order'}
,{header:"Status",dataIndex:'order'}
,{header:"Action",renderer: renderViewResults}
]
}),
sm: checkModel,
store: new Ext.data.Store({
root: 'results',
method: 'POST',
autoSave: false,
batch: true,
proxy: new Ext.data.HttpProxy({
api: {
read: 'results.php?task=LISTING',
create: 'results.php?task=CREATE',
update:'results.php?task=UPDATE',
destroy: 'results.php?task=DELETE'
}
}),
writer: new Ext.data.JsonWriter({
encode: true,
writeAllFields: true,
batch: true
}),
reader: new Ext.data.JsonReader({
totalProperty: 'total',
successProperty: 'success',
idProperty: 'nr',
root: 'results',
fields: ['nr','order','date', 'created', 'type', 'category', 'sub_category_nm', 'item', 'properties', 'status']
}),
baseParams: ahist_order_params
}),
bbar:[
'-',{
text: 'Add',
iconCls: 'icon-add',
handler: function(){
editMoreData(0);
}
},
'-', {
text: 'Search',
iconCls: 'icon-search',
handler: function(){
displaySearchFilter(origid);
}
},
'-',{
text: 'Sign Orders',
iconCls: 'icon-warning',
handler: function(){
displaySearchFilter();
}
},
'-',{
text: 'Cancel',
iconCls: 'icon-delete',
handler: function(){
displaySearchFilter();
}
},
'-', {
text: 'Refresh',
iconCls: 'icon-table_refresh',
handler: function(){
Ext.getCmp('orderGridPanel').stopEditing(false);
var rs = orderGridPanel.store.getModifiedRecords();
if (rs.length > 0) {
var status = window.confirm("Some data modified on grid, do you want to save grid data before loading latest data ?");
if (status){
orderGridPanel.store.save();
}
}
orderGridPanel.store.load();
}
},
'-', {
text: 'Print',
iconCls: 'icon-print',
handler: function(){
statusStr = getHistGridSelection();
}
}
,'->'
,'Display:','-',
{
xtype: 'radio',
name: 'search_filter',
id:'search_filter_1',
inputValue: 1,
boxLabel: 'Open Orders',
handler: onChangeLoadFilter ,
checked : true
},'-',{
xtype: 'radio',
name: 'search_filter',
id:'search_filter_2',
inputValue: 2,
boxLabel: 'All Orders',
handler: onChangeLoadFilter
},'-',{
xtype: 'radio',
name: 'search_filter',
id:'search_filter_3',
inputValue: 3,
boxLabel: 'Orders 5 days back',
handler: onChangeLoadFilter
}
,'-',{
xtype: 'radio',
name: 'search_filter',
id:'search_filter_4',
inputValue: 4,
boxLabel: 'Cancelled Orders',
handler: onChangeLoadFilter
}
]
};
Now when I click on the search button this code executes:
function displaySearchFilter(id){
var formPanel = new Ext.FormPanel({
frame: true,
labelWidth:150,
bodyStyle: 'padding:5px 5px 0',
items: [{
xtype: 'fieldset',
defaultType: 'textfield',
items: [
{
xtype : 'container',
border : false,
layout : 'column',
anchor : '100%',
style : 'margin-top:8px;margin-bottom:8px;',
defaultType : 'field',items :[
{
xtype: 'label',
style: 'float: left; margin-left:3px;margin-top:3px;',
text: 'From'
},
{
fieldLabel: 'From Date',
xtype: 'datefield',
id: 'from_date',
style: "float: left; margin-left:3px;",
width:70
},
{
xtype: 'label',
style: 'float: left; margin-left:5px;margin-top:3px;',
text: 'To'
},
{
fieldLabel: 'To Date',
xtype: 'datefield',
id: 'to_date',
style: 'float: left; margin-left:5px;',
width:70
},
{
xtype: 'label',
style: 'float: left; margin-left:5px;margin-top:3px;',
text: 'Patient'
},
{
fieldLabel: 'Patient ID',
id:'patient',
xtype: 'textfield',
style: 'float: left; margin-left:5px;',
value: btpacs.data.Origid,
mode:'local'
},
{
xtype:'label',
style:'float:left;margin-left:5px;margin-top:3px;',
text:'Display'
},
{
xtype:'combo',
id:'search_filter',
store:btpacs.data.searchFilter,
typeAhead: true,
mode: 'local',
triggerAction: 'all',
selectOnFocus: true,
lastQuery: '',
emptyText:'Select an option...',
width : 120
}
]},
{
xtype: 'combo',
fieldLabel: 'Order Type',
name: 'category',
id:'cat',
store: btpacs.data.CpoeCategory,
hiddenName: 'category',
triggerAction: 'all',
emptyText:'Select an option...',
width : 300,
mode: 'local',
lastQuery: '',
listeners : {
select : function (f, e){
//params: { cat_id: Ext.getCmp('cat').getValue()}
//subCategoryStore.load();
var category_id = Ext.getCmp('cat').getValue();
subCategoryStore.reload({
params: { cat_id: category_id}
});
}
}
},
{
xtype: 'multiselect',
fieldLabel: 'Sub Category',
name: 'sub_category',
id:'sub_cat',
displayField: 'sub_cat_name',
valueField: 'sub_cat_id',
store: subCategoryStore,
hiddenName: 'sub_category',
emptyText:'Select Order Type First...',
triggerAction: 'all',
width : 300,
mode: 'local',
listeners : {
click : function (f, e){
var sub_cat_id = Ext.getCmp('sub_cat').getValue();
itemStore.reload({
params: { sub_cat_ids: sub_cat_id}
});
}
}
},
{
xtype: 'multiselect',
fieldLabel: 'Items',
name: 'items',
displayField: 'item_name',
valueField: 'item_id',
store:itemStore,
hiddenName: 'items',
triggerAction: 'all',
width : 300,
mode: 'local'
},
{
xtype : "multiselect",
fieldLabel : "Doctor List",
id: 'placed_doctor_name',
displayField: 'name',
valueField: 'name',
typeAhead: true,
mode: 'local',
triggerAction: 'all',
selectOnFocus: true,
lastQuery: '',
store:doctorStore,
width : 300
}]
}],
buttons: [{
text: 'Search',handler: function() {
formPanel.getForm().submit({
method: 'POST',
url: 'ajax/results.php?task=SEARCH', // when this file is executed the result is return properly as I want
root: 'results',
params : {'origid': origid},
success: function(f, a) {
// after the result is successfully returned I cannot display it here.I am not sure what I am missing.Here I want to assign all the result to orderGridPanel
win.close();
},
failure: function(f, a) {
alert("Request failed");
f.markInvalid(a.result.errors);
}
});
}
},
{
text: 'Cancel',
handler: function () {
win.close();
}
}]
});
win = new Ext.Window({
layout: 'fit',
width: 650,
height: 520,
defaults: {
autoScroll: true
},
closeAction: 'close',
title: 'Search Orders',
plain: true,
items: [formPanel]
});
win.show();
}
Thanks in advance.
You need to load the data into the store of the grid if you want the grid to display the data.