PDA

View Full Version : [FIXED-169] xds-1.0.2.0 - form api bug



jvolt
7 Jul 2010, 6:15 AM
The new version export the form api between ''.

ie:
[...]
xtype: 'form',
layout: 'column',
frame: false,
buttonAlign: 'right',
api: [B][COLOR=

jarrednicholls
7 Jul 2010, 7:02 AM
If the api object does not evaluate to a runtime object, it is turned into a string. In other words, User.get and User.set do not exist...did you load your Ext.Direct API in the project preferences first? Turning it into a string will not only avoid an error, but it will also help detect if something is not correct in the Direct API that's loaded or something mis-typed in the api config.

paramOrder: what...the...heck? Are you able to reproduce this reliably? I'd love to know how that happened, and I'll take care of it right away.

ldonofrio
7 Jul 2010, 7:29 AM
I've a similar problem, in my existing old designer project if i change "paramOrder" for one store the paramOrder is changed in all the direct stores.
Please help, i can't export my project now!
Thanks

jvolt
7 Jul 2010, 7:47 AM
Yes, that happens with the api property too.

I needed change all forms because changed one of them then all got same api value.

I don't know why...

jvolt
7 Jul 2010, 8:13 AM
If the api object does not evaluate to a runtime object, it is turned into a string. In other words, User.get and User.set do not exist...did you load your Ext.Direct API in the project preferences first? Turning it into a string will not only avoid an error, but it will also help detect if something is not correct in the Direct API that's loaded or something mis-typed in the api config.

paramOrder: what...the...heck? Are you able to reproduce this reliably? I'd love to know how that happened, and I'll take care of it right away.

About the paramOrder: I just don't know what caused that, but i didn't put 'ext-gen2' as paramOrder. The paramOrder property was

jarrednicholls
7 Jul 2010, 8:19 AM
jvolt, did you configure a proxy server by any chance? Just want to rule that out from a connection standpoint, since that IP address would be outside of the default whitelist (which is localhost, 127.0.0.1, private IP subnets such as 192.168.x.x, 172.16.x.x, 10.x.x.x, etc.). If not, it's something else obviously...your configuration looks great according to the screenshot.

When you go to choose the directFn for a DirectStore, are any of your actions/methods loaded up, or no?

jvolt
7 Jul 2010, 10:36 AM
Well, sorry i forgot to comment about my ip range. The 155.102.177.0 is my network, the 155.102.177.55 is a machine in the network,

jvolt
8 Jul 2010, 6:54 AM
jarred! I discovered what's the paramOrder bug!

Just try put 'id' in paramOrder....

I got a single param, and its called id. When i type

jarrednicholls
8 Jul 2010, 7:17 AM
api/paramOrder/etc. bug fixed for next release.

jvolt
8 Jul 2010, 10:45 AM
Thanks =D

jvolt
9 Jul 2010, 5:13 AM
I gave up trying configure the API, that just don't work for me. The Ext Designer keep putting '' to api property.

[COLOR=

jarrednicholls
9 Jul 2010, 6:22 AM
Hey jvolt,

Do you have your Ext Direct API loaded up? Any object/array configuration will automatically save itself as a string when it cannot be evaluated. So, if there's a syntax error, or the object doesn't exist, then it saves as a string. In this case, your "User" action/namespace must not exist, yet. Here are a bunch of screenshots showing the DirectStore and Direct API stuff working perfectly fine when it's loaded up. See if any of these screens help:

PHP Direct config:
http://clip2net.com/page/m50071/6736072

Direct API configured in project and loaded up:
http://clip2net.com/page/m50071/6736058

DirectStore's directFn showing available actions/methods now:
http://clip2net.com/page/m50071/6736092

DirectStore's directFn method shown in code:
http://clip2net.com/page/m50071/6736003

GridPanel connected to DirectStore and showing loaded data:
http://clip2net.com/page/m50071/6735988

FormPanel's api object setup:
http://clip2net.com/page/m50071/6736046

FormPanel's api object setup 2:
http://clip2net.com/page/m50071/6736029

GridPanel w/ DirectStore working in Preview:
http://clip2net.com/page/m50071/6736202

The Preview generates and runs the same code that is exported with the Project. This didn't use to be the case in versions prior to 1.0.2. This change allows complex setups such as DirectStore's with Direct API providers, complex Grid setups with selection models, etc. etc. all to function in Preview. If the Preview renders blank, then there is an error in the code or setup somewhere, and the error would also be present when running the code that's exported with the project (since it's the same code).

Hope that helps. Let me know if you get it working.

jvolt
11 Jul 2010, 5:58 AM
Settings: http://img696.imageshack.us/img696/6061/settingss.png
If i try a wrong url: http://img138.imageshack.us/img138/2483/errorsettings.png

Config:
http://img295.imageshack.us/img295/3249/configk.png
http://img249.imageshack.us/img249/2865/filese.png

The browser shows the file correctly: http://img248.imageshack.us/img248/2740/localhost.png
Console, the apache and PHP are running correctly: http://img17.imageshack.us/img17/9904/consolep.png

Look at DirectFn property, The menu that you show is just a litle square to me: http://img690.imageshack.us/img690/3329/notloaded.png

The version: http://img709.imageshack.us/img709/2999/versions.png


I has tested that on two computers using Windows 7 x64 in my office network with a debian server and using localhost running xampp, no one loaded.
Now I'm testing on my laptop at home, using Ubuntu 10.04 Lucid Lynx with Apache2 and PHP5 running, also don't work.

There's some screenshots, are as your screenshots, but don't work.


Do you think i could install some type of dependency? Why that don't work for me? I'm using the same Direct API you used...

jarrednicholls
12 Jul 2010, 11:59 AM
Hi jvolt,

Does your Direct API return JSON as such? http://clip2net.com/clip/m50071/1278964592-clipn31510-36kb.png

Also notice that the "url" I have changed to be an absolute URL instead of relative, or else the actual Direct calls will not work. This shouldn't cause the actions not to load though, you should see your actions in the directFn box. But once the actions did load correctly, the actual direct calls would not function with a relative router url.

If your API returns in proper JSON format, then we'll have to look a little deeper.

jarrednicholls
12 Jul 2010, 12:01 PM
Here is my api.php file, for reference:



<?php
require('config.php');
header('Content-Type: text/javascript');

// convert API config to Ext.Direct spec
$actions = array();
foreach($API as $aname=>&$a){
$methods = array();
foreach($a['methods'] as $mname=>&$m){
$md = array(
'name'=>$mname,
'len'=>$m['len']
);
if(isset($m['formHandler']) && $m['formHandler']){
$md['formHandler'] = true;
}
$methods[] = $md;
}
$actions[$aname] = $methods;
}

$cfg = array(
'url'=>'http://localhost/deploy/examples/direct/php/router.php',
'type'=>'remoting',
'actions'=>$actions
);

if (!isset($_GET["format"]) || $_GET["format"] != "json"){
echo 'Ext.app.REMOTING_API = ';
} else {
$cfg["descriptor"] = "Ext.app.REMOTING_API";
}

echo json_encode($cfg);

if (!isset($_GET["format"]) || $_GET["format"] != "json"){
echo ';';
}

jvolt
13 Jul 2010, 5:29 AM
Thanks very much jarred!

Now it works!

Your api.php isn't that one in the ExtJs 3.2.1 public release, it was why didn't work here, I was using the 3.2.1 public release direct example api.php...

Thanks very much, now it's working =]

jarrednicholls
13 Jul 2010, 5:45 AM
You are correct, it isn't. I had to modify both the "url" to be absolute (so the Designer understood it basically) and add the "descriptor" in the json response.

I will get with the Ext.Direct team and discuss making the API endpoints more intelligent in terms of the "url" that's returned...to perhaps be more intelligent in terms of determining the relative path or having an option to return an absolute url. As it stands now, the "url" is expected to be configured per your environment. However, the "descriptor" is an issue that I would so much as call a bug. The API for all Ext.Direct routers are suppose to listen to "?format=json" and return the API description in JSON format. I had to manually add it...even though I was told otherwise. So I will discuss this with other team members to see if we can standardize that.

Very sorry for the troubles, but I'm glad you're up and running and I hope others will learn from this :-)

jvolt
14 Jul 2010, 6:34 AM
jarred, there's a litle problem...

That is working fine, but if I close the Ext Designer and re-open that says

jarrednicholls
14 Jul 2010, 6:54 AM
Thanks jvolt, I'll look into this and resolve for the next release.

Artistan
19 Jul 2010, 6:17 AM
Maybe I am missing some vital piece of documentation butt...
Dealing with the descriptor. I had to set it to a single var (not namespace) in order to get it to work. Designer does not add the name space before the descriptor if you are using a namespace. it just sets the descriptor = {data}.

"BenAdminDirect" WORKS...

BenAdminDirect = {"url":"http://extadmin2.zenddev.net/ext_router.php","type":"remoting","actions":{"mod_Echo":[{"name":"show","len":1,"serverMethod":"send"},{"name":"mult","len":1,"serverMethod":"multiply"}],"namespace":"BenAdmin.DirectAPI","descriptor":"BenAdminDirect"};
Ext.Direct.addProvider(BenAdminDirect);


"BenAdmin.DirectAPI.dsc" DOES NOT WORK....

BenAdmin.DirectAPI.dsc = {"url":"http://extadmin2.zenddev.net/ext_router.php","type":"remoting","actions":{"mod_Echo":[{"name":"show","len":1,"serverMethod":"send"},{"name":"mult","len":1,"serverMethod":"multiply"}],"namespace":"BenAdmin.DirectAPI","descriptor":"BenAdmin.DirectAPI.dsc"};
Ext.Direct.addProvider(BenAdmin.DirectAPI.dsc);

jarrednicholls
19 Jul 2010, 7:50 AM
Quite right Artistan...there is a small bug in the handling of custom namespaced Direct API descriptors. You can alternatively use the default, Ext.app.REMOTING_API as a workaround by simply not specifying one at all. I will get this issue fixed for the next release.

jvolt
22 Jul 2010, 5:01 AM
Well, still everytime I open the Designer all api's get the value '{}'. =(

jarrednicholls
22 Jul 2010, 5:36 AM
I'm assuming you're running 1.0.2.6. If your Direct API loads successfully, approximately 1 second after that happens, all object configurations in the project are re-instated automatically. If you wait one second after you see the message "Successfully updated Ext.Direct API.", your values are still strings? If so, do me a favor and attach your project file and send me your Direct API config.php file and I can take a look. If you don't want to attach the files, you can email me jarred [at] sencha.com. Thanks.