PDA

View Full Version : How make request from child window



neosky
3 Dec 2013, 12:04 PM
I want to send request data from textarea table which is stored in the database. How I do it:i am open the form there a table on this form there is a button, push the button displays a new form with tekstarea and two buttons (save (push and data from textarea go to the table), and cancel). All this works well, but sending a request does not work. That how i do request:


doEditsave: function(button) {
var win = button.up('window')
grid = win.down('grid')
store = grid.store

var request = {
filetId: grid.getfileId(),
type:grid.getFileType(),

attributes: [] }; store.each(function(rec, index, length)
{ request.attributes.push({type:rec.get('type'),value:rec.get('value')}); });

Ext.Ajax.request({
url: Config.Api.url('/file/update'),

method: 'POST',
jsonData: request,

success: function(responseObject){
var obj = Ext.decode(responseObject.responseText);
if (obj.status == 'SUCCESS'){
grid.getStore().reload()
alert("SAVEEED")
}else
{alert(responseObject.responseText) } },
failure: function(responseObject)
{ if (responseObject.status == 403)
{ alert('ERRORRRR'); }
else { alert(responseObject.responseText); } }, }); },

program does not find the store, here


var win = button.up('window')
grid = win.down('grid')
store = grid.store

because the table with data is in a different form and not in the form where I send request. how can I contact the parent form and make request? thanks

scottmartin
3 Dec 2013, 1:17 PM
You can assign a storeId to the store and use the StoreManager to gain access to the store.



storeId : 'simpsonsStore',




var store = Ext.data.StoreManager.lookup('simpsonsStore'),


If you are using MVC, you can use the built in getter.



getMystoreStore();