download2565 2012-09-27 07:37
浏览 30
已采纳

如何在javascript中将组合框(EXTJS)中的参数传递给php文件?

First I declared an Ext.form.ComboBox which name is leventcombo and also I created a store Ext.data.JsonStore its name is leventstore. I can reach the php file and the data can return the javascript. But I cannot pass id value to the php file. how can I send it?

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);
?>
  • 写回答

1条回答 默认 最新

  • douzhulan1815 2012-09-27 12:08
    关注

    Take a look here: http://docs.sencha.com/ext-js/4-1/#!/api/Ext.Ajax-cfg-extraParams

    You should use 'params' config option.

    If you want to load store manually, use the following:

    leventstore.proxy.extraParams.id = your_id;
    leventstore.load();
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 csmar数据进行spss描述性统计分析
  • ¥15 各位请问平行检验趋势图这样要怎么调整?说标准差差异太大了
  • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题
  • ¥15 wpf界面一直接收PLC给过来的信号,导致UI界面操作起来会卡顿
  • ¥15 init i2c:2 freq:100000[MAIXPY]: find ov2640[MAIXPY]: find ov sensor是main文件哪里有问题吗
  • ¥15 运动想象脑电信号数据集.vhdr
  • ¥15 三因素重复测量数据R语句编写,不存在交互作用
  • ¥15 微信会员卡等级和折扣规则
  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?