我的代碼有問題。
我使用ExtJs和Codeigniter來開發我的web應用程序
其實我的問題是從extjs發送參數到CI控制器。
我有一個簡單的代碼這樣
從extjs發送參數到PHP文件(Codeigniter)
Ext.Loader.setConfig({enabled: true});
Ext.Loader.setPath('Ext.ux', '../../extjs/src/ux');
Ext.require([
'Ext.grid.*',
'Ext.data.*',
'Ext.ux.grid.FiltersFeature',
'Ext.toolbar.Paging'
]);
Ext.define('materialspec', {
extend: 'Ext.data.Model',
fields: [
{name: 'id_planmaterial', type: 'string'},
{name: 'material_desc', type: 'string'},
{name: 'material_priority', type: 'string'},
{name: 'material_product_code', type: 'string'},
{name: 'material_qty', type: 'string'},
{name: 'material_unit', type: 'string'},
{name: 'material_note', type: 'string'},
{name: 'docNo', type: 'string'}
]
});
var store2 = Ext.create('Ext.data.Store', {
id: 'store2',
model: 'materialspec',
proxy: {
type: 'ajax',
url : '../planspec/planmaterial',
reader: {
type: 'json',
root: 'id_planmaterial'
}
},
sorters: [{
property : 'id_planmaterial',
direction : 'ASC'
}]
});
Ext.onReady(function(){
Ext.QuickTips.init();
var encode = false;
var local = true;
var filters2 = {
ftype: 'filters',
encode: encode,
local: local,
filters: [
{
type: 'boolean',
dataIndex: 'id_planmaterial'
}
]
};
var grid2 = Ext.create('Ext.grid.Panel', {
border: false,
store: store2,
columns: [
{ header: "No.", xtype: 'rownumberer', width: 30, align: 'center' },
{ id: 'docNo', header: "Document No.", dataIndex: 'docNo', sortable: true, filter: {type: 'string'} },
{ id: 'descMaterial', header: "Description", dataIndex: 'material_desc', flex:1, filter: {type: 'string'} },
{ id: 'priority', header: "Priority", dataIndex: 'material_priority', flex:1, filter: {type: 'string'} },
{ id: 'productCode', header: "Product Code", dataIndex: 'material_product_code', flex:1, filter: {type: 'string'} },
{ id: 'qty', header: "Quantity", dataIndex: 'material_qty', flex:1, filter: {type: 'string'} },
{ id: 'unit', header: "Unit", dataIndex: 'material_unit', flex:1, filter: {type: 'string'} },
{ id: 'note', header: "Note", dataIndex: 'material_note', flex:1, filter: {type: 'string'} }
],
loadMask: true,
features: [filters2],
title: 'PlanSpec Material',
height: '100%',
width: '100%',
renderTo: 'gridMaterial'
});
store2.load({
params:{
test:2
}
});
});
而且我有這樣
public function planmaterial(){
$result = $this->input->post('test');
echo $result;
}
控制器其實我覺得它應該給一個輸出=「2」。
但輸出未顯示。
那麼,我該怎麼辦?
請告訴我關於我的錯誤。
感謝您的關注:)