首先,我声明了一个Ext.form.ComboBox,其名称是leventcombo,我还创建了一个商店Ext.data.JsonStore,它的名字是leventstore。我可以到达php文件,数据可以返回javascript。但是我无法将id值传递给php文件。我怎么发送呢?
var leventcombo = new Ext.form.ComboBox({
store: leventstore,// call jsonstore
fieldLabel: '',
minChars: 2,
width:50,
displayField:'isim',
valueField: 'isim',
typeAhead: false,
loadingText: dil('Aranıyor...'),
hideTrigger:true,
tpl: template1,
emptyText: dil('levo ...'),
itemSelector: 'div.search-item',
name: 'leventwindeneme',
id: 'leventwindenemeID',
anchor: '100%',
allowBlank:false,
listeners:{
beforequery: function(){
}
}
});
var leventstore = new Ext.data.JsonStore({
totalProperty: 'results',
root: 'rows',
id: 'id',
proxy: new Ext.data.HttpProxy({
url: 'phps/leventstore.php?lang=dil(lang)'
}),
fields: [
{
///phpden dönen veriler
name:'id'
},{
///phpden dönen veriler
name:'isim'
}]
});
leventstore.php:
<?php
include_once("kutuphane/inc.php");
$sql="select id, isim from levent";
$_SESSION["VT"]->doQuery($sql);
$donecek = $_SESSION["VT"]->arrayYapVer();
$veriler=array();
if (sizeof($donecek) > 0) {
foreach ($donecek as $file) {
$tempFi = array();
$tempFi = array(
"id" => $file["id"],
"isim" => $file["isim"]
);
array_push($veriler, $tempFi);
}
}
$donecek = array("results" => (sizeof($donecek)), "success" => "true", "rows" => $veriler);
echo json_encode($donecek);
?>
答案 0 :(得分:0)
看看这里: http://docs.sencha.com/ext-js/4-1/#!/api/Ext.Ajax-cfg-extraParams
你应该使用'params'配置选项。
如果要手动加载存储,请使用以下命令:
leventstore.proxy.extraParams.id = your_id;
leventstore.load();