私のような質問が他にもあることは知っていますが、私の場合は詳細が重要であり、この質問の詳細は既に作成された質問の詳細とは異なります。ただし、問題は、既に行われているグリッドから始めて、extjs を使用して新しいウィンドウを作成しようとしていることです。この新しいウィンドウには、前のグリッドで選択された要素へのすべての参照を含むグリッドが含まれている必要があります。これが私の解決策です。最初のグリッド内に ajax 呼び出しを配置しました。クリックして 2 番目のグリッドに移動する画像を含む列を作成しました。しかし、それは機能していません。画像をクリックしても何も表示されませんか?
ajax呼び出しを間違っていますか?新しいウィンドウにあるはずのグリッドのストアのページにjsonを渡すのは間違っていますか? 何か案が?これは私のグリッドのコードです:
var grid = Ext.create('Ext.grid.Panel', {
store: store1,
stateful: true,
collapsible: true,
multiSelect: true,
stateId: 'stateGrid',
columns: [
{
text : 'id',
flex : 1,
sortable : true,
dataIndex: 'id'
},
{
text : 'buyer_member_id',
width : 75,
sortable : true,
dataIndex: 'buyer_member_id'
},
{
text : 'Client Name',
width : 200,
sortable : true,
dataIndex: 'name'
},
{
xtype : 'actioncolumn',
width : '5%',
sortable : false,
items : [{
icon : '../static/accept.gif',
tooltip : 'See Admants',
handler : function(grid, rowIndex, colIndex){
var row = grid.getStore().getAt(rowIndex);
buyer_member_id = grid.getSelectionModel.getSelection()[1]
Ext.Ajax.defaultHeaders = {
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
};
Ext.Ajax.request({
method : "GET",
url: '/mygrid/',
params:{
buyer_member_id: buyer_member_id,
},
success : function(response) {
var obj = response;
try {
obj = Ext.decode(response.responseText);
} catch (error) {}
if (obj) {
Ext.create('Ext.window.Window', {
title: 'Hello',
height: 200,
width: 400,
layout: 'fit',
items: { // Let's put an empty grid in just to illustrate fit layout
xtype: 'grid',
border: false,
columns: [
{
text : 'id',
flex : 1,
sortable : true,
dataIndex: 'id'
},
{
text : 'name',
width : 300,
sortable : true,
dataIndex: 'name'
}], // One header just for show. There's no data,
store: new Ext.data.JsonStore({
// store configs
storeId: 'myStore',
proxy: {
type: 'ajax',
url: '/admants/',
reader: {
type: 'json',
}
},})
}}).show();
} else {
alert("Invalid response")
}
},
failure : function(response) {
alert("Data request failed");
}
});
}
}]
}
],