PDA

View Full Version : Direct MVC Architecture Sencha Designer



nizhelya
22 Feb 2012, 10:15 AM
Hello!

May I ask you some questions.
My project had been written a long time ago in PHP, MySql и JS.
Now the time has come to upgrade it.
I like your framework extjs4 c Sencha Designer 2 very much.
First of all I made out an example of "Mapping a Grid to a MySQL table using Direct and PHP"
It works well because it uses Ext.onReady
I tried to realize it in Sencha Designer 2 using MVC Architecture.
It doesn't work.

1. In Sencha Designer for store api attribute in the Component Config inspector I change value on
{
create: QueryDatabase.createRecord,
read: QueryDatabase.getResults,
update: QueryDatabase.updateRecords,
destroy: QueryDatabase.destroyRecord
}

Than save and ooking through the code I see that api has the value as string

proxy: {
type: 'direct',
api: '{
create: QueryDatabase.createRecord,
read: QueryDatabase.getResults,
update: QueryDatabase.updateRecords,
destroy: QueryDatabase.destroyRecord
}'
}

Firebug gives out an error

fn is undefined

method = fn.directCfg.method; ext-all-debug.js (строка 52629)

2. If I remove the quotes

api: {
create: QueryDatabase.createRecord,
read: QueryDatabase.getResults,
update: QueryDatabase.updateRecords,
destroy: QueryDatabase.destroyRecord
}

Firebug gives out an error

QueryDatabase is not defined

syncRequire: function() { ext-all-debug.js (строка 4637)

Help!

3.Most os developers use Mysql and PHP

Please, update sample "Mapping a Grid to a MySQL table using Direct and PHP"
for MVC Architecture

Thank you beforehand.

bharatn
27 Feb 2012, 3:37 PM
Hi,

Currently you cannot use references inside object.

However you can use string values as follows



api:{ create :'/controller/new',
read :'/controller/load',
update :'/controller/update',
destroy :'/controller/destroy_action'
}

stewardsencha
26 Apr 2012, 4:59 PM
Currently? Has that changed?



I am trying to populate a form panel.
I have added a direct proxy to the model.
In a controller override I call this.getModel('VMaster').load(6);

I fail at


if (operation=='read')
{
method=fn.directCfg.method
...


ReferenceError: directCfg is not defined

The value of fn is "Ext.app.VMaster.view" Just the string.

The api is set up as follows:
{
create: 'Ext.app.VMaster.create',
read: 'Ext.app.VMaster.view',
update: 'Ext.app.VMaster.update',
destroy:'Ext.app.VMaster.destroy'
}

If I leave the quotes off, fn is undefined.

How can I enter a directCfg in SA?
Thanks

bharatn
27 Apr 2012, 8:27 AM
Hi, That post that you are referring is a bit old. Direct configuration now support references for api

so you can use this


{
create: QueryDatabase.createRecord,
read: QueryDatabase.getResults,
update: QueryDatabase.updateRecords,
destroy: QueryDatabase.destroyRecord
}