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 fluent的在模拟压强时使用希望得到一些建议
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
  • ¥15 模糊pid与pid仿真结果几乎一样
  • ¥15 java的GUI的运用
  • ¥15 Web.config连不上数据库
  • ¥15 我想付费需要AKM公司DSP开发资料及相关开发。
  • ¥15 怎么配置广告联盟瀑布流
  • ¥15 Rstudio 保存代码闪退