gpt4 book ai didi

php - TreeStore 传递参数 - EXTJS 4

转载 作者:行者123 更新时间:2023-11-28 09:21:40 26 4
gpt4 key购买 nike

这是extjs 4传递参数groupid

var store = Ext.create('Ext.data.TreeStore', {
proxy: {
type: 'ajax',
autoLoad: true,
url: 'tree1.php',
extraParams :{groupid:'2'},
// Here Magic comes
},
actionMethods: 'GET',
sorters: [{
property: 'leaf',
direction: 'ASC'
}, {
property: 'text',
direction: 'ASC'
}]
});

tree1.php

<?php
mysql_connect("localhost", "root", "") or die("Could not connect");
mysql_select_db("db_gps") or die("Could not select database");


$parent_id = $_GET['node'];
$group_id = $_GET['groupid'];

if ($parent_id > 0){

}else{
$parent_id = "0";
}
// 1) Remove false as checked
if ($group_id > 0){
$query = "SELECT * FROM (SELECT GroupID as id,GroupName as text,0 as parent_id FROM tbl_group UNION SELECT DeviceID as id,VehicleNo as text,GroupID as parent_id FROM Tbl_device) as u WHERE parent_id = '".$parent_id."' AND id= '".$group_id."' ORDER BY u.text ASC";
}else{
$query = "SELECT * FROM (SELECT GroupID as id,GroupName as text,0 as parent_id FROM tbl_group UNION SELECT DeviceID as id,VehicleNo as text,GroupID as parent_id FROM Tbl_device) as u WHERE parent_id = '".$parent_id."' ORDER BY u.text ASC";
}


$rs = mysql_query($query);
$arr = array();
while($obj = mysql_fetch_object($rs)) {

$qq = mysql_query("SELECT * FROM tbl_device WHERE GroupID='". $obj->id ."'");

if (mysql_num_rows($qq) > 0) {
// if have a child
//echo "have child";
$obj->leaf = "false";
//$obj->cls = 'folder';
} else {
// if have no child

$obj->leaf = "true";
//$obj->cls = 'file';
}

// 2) If no leaf then destroy the attribute
if($obj->leaf != "false"){
// 1) set checked attribute with an boolean value
$obj->checked = false;
}
$arr[] = $obj;
}

//echo $parent_id;
echo json_encode($arr);
?>

FireBug 屏幕截图

enter image description here

问题

当我使用FireBug获取参数时,没有任何groupid参数。为什么?我完全不知道这有什么问题。
请帮忙,非常感谢!

最佳答案

看起来不错,但是extraParams :{'groupid':'2'},--> string

关于php - TreeStore 传递参数 - EXTJS 4,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14926472/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com