PDA

View Full Version : [FIXED] 2.0.0.000311 - Ext Direct API



andyboxer
14 Mar 2012, 4:18 AM
In build 268 api.php response in js-form was accepted by designer and I could successfully choose proper directFn from the list. In build 311 api.php is not accepted: I have "Ext.Direct Remoting Specification failed to load" error on project opening and directFn has empty list.

Please note that when build 268 got api.php it put its content into designer.html. This disable dynamic loading:

<script type="text/javascript">
Ext.ns("Ext.app.REMOTING_API");
Ext.app.REMOTING_API = {"url":"php/router.php","ty............};
Ext.Direct.addProvider(Ext.app.REMOTING_API);
</script>


But can api.php call be included in designer.html (as described here (http://docs.sencha.com/ext-js/4-0/#!/guide/direct_grid_pt1) in "III. Setting Up" section)


<script src="php/api.php"></script>

and Ext.Direct.addProvider be added to designer.js or elsewhere.


By the way is there a setting for custom name of designer.html and designer.js?

bharatn
15 Mar 2012, 3:26 PM
Hi,

Regarding the message "Ext.Direct Remoting Specification failed to load", please check your url prefix is correct in Designer settings. We used to default that to localhost and dont do it now.

There is no way to change names of designer.html and designer.js currently.

I will look at your other suggestion as to whether we need to include app.php.

Thanks

andyboxer
15 Mar 2012, 10:35 PM
Hi, Bharat!
my url prefix is set to "http://dev/myapp/" and ext direct api is set to "http://dev/myapp/data/api.php" and when I open the project designer opens the settings window with redunderlined ext direct api value

bharatn
15 Mar 2012, 11:18 PM
Ok that explains it. Make sure direct api url is valid(test and fix it in browser first) so that you can then choose directFn from the list.

Regards

andyboxer
16 Mar 2012, 12:28 AM
I've checked the url "http://dev/myapp/data/api.php" it returns


Ext.ns("Ext.app"); Ext.app.REMOTING_API = {"url":"data\/router.php","type":"remoting","actions":{"MyDb":[{"name":"getMyCoolStuff","len":1}]}};

But directFn dropdown shows grey "None Available"...

tammie
18 Mar 2012, 12:35 PM
I am also getting this error in 311. My api link is correct (it opens fine in my browser), but it seems to only load sporadically.

I may have figured out part of the issue... In the past I've noticed that I've had to point the api to another valid direct url, then back again to my updated api, or it would apparently cache and miss new functions. I'd done this on my current project forgetting that my other virtual machine was turned off, so at that point it wasn't finding a valid api - even though I'd then pointed the api back to my updated file - but Direct missed it. When I pointed my api at a valid dummy api, then back again, things began working again, and I could actually select my direct functions from within designer.

Would it be possible for designer to rewrite the cache for the direct api for every settings save? (As opposed to when the link is changed.)

Thanks!

bharatn
18 Mar 2012, 12:43 PM
Hi Tammie,

Thats a good suggestion. Someone also suggested to provide a reload api button. So we may provide one of these options to reload direct api.

Thanks

nizhelya
19 Mar 2012, 12:38 AM
API works fine. But when I`m saving project in Designer , I`m getting an error: my API saves as a string! It must be saved as an object. A have to manually delete quotes in file. Here are screenshots:


StAddress.js
32879
Ext Designer
32880

Folder structure
32881
Designer.html
32882

What I`m doing wrong, or it's a bug?

tammie
19 Mar 2012, 1:14 PM
I mistakenly posted this in the Ext Designer forum (http://www.sencha.com/forum/showthread.php?189117-Posting-a-Form-with-Direct-API-in-Designer-2) yesterday and couldn't figure out how to move it over here. No matter what I enter in the api field (in my case for a form panel), designer makes it a string.

bharatn
19 Mar 2012, 8:59 PM
AM
Nizhelya/Tammie,

When you use the api, use the value portion as a string.

Here is an example
http://www.sencha.com/forum/showthread.php?149305-Ext.data.proxy.Direct-and-Ext.form.Panel-api-are-not-compatible-with-ExtJS-4-MVC

eg from the post



api: { read: "Trackr.server.TaskRepository.getAllInfo" }
So it will correctly translate as an object.

nizhelya
22 Mar 2012, 6:14 AM
bharatn (http://www.sencha.com/forum/member.php?284206-bharatn)
Your code

api: { read: "Trackr.server.TaskRepository.getAllInfo" } don't work. It work only if I manually delete quotes.

In senca Doc (http://docs.sencha.com/ext-js/4-0/#%21/guide/direct_grid_pt2) it is decribed as:

proxy: { type: 'direct', api: { create: QueryDatabase.createRecord, read: QueryDatabase.getResults, update: QueryDatabase.updateRecords, destroy: QueryDatabase.destroyRecord } },
How I can make it in Designer (it makes code with quotes)?

3301233013

nizhelya
5 Apr 2012, 6:39 AM
Please, aswer the previous question! I permanently have to edit manually the Designer generated api code for grid and form.


For grid:
As bharatn adviced I write in the Designer:

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


Designer generates:


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


I have to manually delete quotes. As it described in Sencha Docs and my code working:



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



For Form:
I write in Designer config "paramOrder": ['uid','table']
Designer generates:


paramOrder: ' [\'uid\',\'table\']'

but it must be:


paramOrder: ['uid','table']

What I am doing wrong ?

bharatn
8 Apr 2012, 1:00 PM
Hi,

I have created a bug. The fix should write the api and paramOrder unquoted.
Thanks for the report




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

vanov
10 Apr 2012, 11:37 PM
I have the same "quotes" problem in Chart Tips config:

This is config code in Designer:

{trackMouse:true,width:140,height:28,renderer:function(storeItem,item) {this.setTitle(storeItem.get("tarif") + " $ for " + Ext.util.Format.date(storeItem.get("date"),"m-Y"));}}


This is the Designer generated code:


tips: {
trackMouse: true,
width: 140,
height: 28,
renderer: function(storeItem,
item){
this.setTitle(storeItem.get(tarif)+ $ for +Ext.util.Format.date(storeItem.get(date),
m-Y));
}
},
So Designer had removed the quotes and the code do not works. Tried any types of quotes.

Also I don`n know how to make a tip for every bar in grouped bar(column) chart. There is only one tip config for all of them... (solved by usung Value property, but it's not well for all cases)
Thanks!

andyboxer
11 Apr 2012, 6:17 AM
Bharatn,

I also noticed that Ext Direct API link is searched directly in the internet, but I have virtual linux machin—É and it's name is defined in hosts Windows file. So browser correctly displays results of the call to api.php and designer, as I understand, does not consider local names.

Could you please check is it correct behaviour?

Thanks!