0

我在一页中有动态创建的链接列表。当我点击一个链接时,我想做另一个页面将打开,并且根据我发送的链接 ID,数据将从数据库中获取并加载到分页 ext 数据网格中。

在我的 Javascript 代码中咆哮

     var extGrid = null;
     var center_data_store=null;
     var exam_id = null;
     Ext.onReady(function(){

// create the data store
exam_id = document.getElementById("hdnExamId").value;  


//I am getting id from one hidden field.  

//alert(exam_id);// Id is coming.  

 multiple_choice_all_data_store = new Ext.data.JsonStore({
    totalProperty: 'total', // total data, see json output
    root: 'results',    // see json output  

    url: 'multiple_choice_all_data_grid.php"?exm_id="+exam_id',  
       //in above url I am passing data.


    fields: [
        {name: 'OEXM_Id', type: 'int'},
        'OEXM_txtareaQuestion','OEXM_rbtnOption','OEXM_txtOption1','OEXM_txtOption2','OEXM_txtOption3','OEXM_txtOption4','OEXM_txtExamId','OEXM_txtExamName'
        ]
});

// load data from the url ( data.php )
multiple_choice_all_data_store.load({params:{start: 0, limit: 15}});

// create the Grid
var multiplechoicealldataGrid = new Ext.grid.GridPanel({
    store: multiple_choice_all_data_store,
    columns: [
        new Ext.grid.RowNumberer(),
        //{header: 'ID', width: 30, sortable: true, dataIndex: 'OEXM_Id',hidden:false},
        {header: 'Question', width: 300, sortable: true, dataIndex: 'OEXM_txtareaQuestion',hidden:false},
        {header: 'Answer', width: 100, sortable: true, dataIndex: 'OEXM_rbtnOption',hidden:false},
        {header: 'Option1', width: 100, sortable: true, dataIndex: 'OEXM_txtOption1',hidden:false},
        {header: 'Option2', width: 100, sortable: true, dataIndex: 'OEXM_txtOption2',hidden:false},
        {header: 'Option3', width: 100, sortable: true, dataIndex: 'OEXM_txtOption3',hidden:false},
        {header: 'Option4', width: 100, sortable: true, dataIndex: 'OEXM_txtOption4',hidden:false}

    ],
    stripeRows: true,
    height:470,
    width:792,
    title:'All Multiple Choice Question Information',
    bbar: new Ext.PagingToolbar({
        pageSize: 15,
        store: multiple_choice_all_data_store,
        displayInfo: true,
        displayMsg: 'Displaying Records {0} - {1} of {2}',
        emptyMsg: "No topics to display"
    })

});

我的问题是我无法在我的 PHP 页面中获取 ID 值。

4

2 回答 2

2

尝试将商店定义中的 url 更改为'multiple_choice_all_data_grid.php?exm_id='+exam_id

然后你的 id 应该在 PHP 中的$_GET['exm_id']变量中可用

于 2012-11-15T10:32:53.673 回答
0

在 ExtJS 中获取元素:
exam_id = Ext.getCmp("hdnExamId").getValue();
getValue() 方法用于检索元素的值。

编辑:
还修复了@Lolo指向的网址。

于 2012-11-15T10:36:35.990 回答