> G.
>
>
>
>
> On Fri, Sep 4, 2009 at 12:47 PM, John Bruce <
email@hidden> wrote:
>>
>> Hi Gustavo,
>>
>> You can use the Wonder Ajax framework to get JSON data loaded so that
>> Ext can use it as a data store. The pricipal is to have a component
>> that generates a url which Ext can use as the remote address for a
>> JSON data store. A very rough example which is similar to the
>> AjaxProxy one is:
>>
>> public class AjaxSimpleProxy extends AjaxComponent {
>>
>> public String actionName;
>>
>> public AjaxSimpleProxy(WOContext context) {
>> super(context);
>>
>> }
>>
>> @Override
>> public void reset() {
>> actionName = null;
>> super.reset();
>> }
>>
>>
>> @Override
>> protected void addRequiredWebResources(WOResponse response) {
>>
>> }
>>
>> @Override
>> public void appendToResponse(WOResponse response, WOContext
>> context) {
>> //WOComponent component = context.component();
>>
>> String actionUrl =
>> AjaxUtils.ajaxComponentActionUrl(context);
>>
>> response.appendContentString(actionUrl);
>>
>> super.appendToResponse(response, context);
>> }
>>
>> public String actionName() {
>> if (actionName == null) {
>> actionName = (String)
>> valueForBinding("actionName");
>> }
>> return actionName;
>> }
>>
>>
>> @Override
>> public WOActionResults handleRequest(WORequest request, WOContext
>> context) {
>> WOResponse response = AjaxUtils.createResponse(request,
>> context);
>>
>> String inputString = request.stringFormValueForKey("data");
>>
>> if (log.isDebugEnabled()) {
>> log.debug("AjaxSimpleProxy.handleRequest: input = "
>> + inputString);
>> }
>>
>> NSSelector action = "" NSSelector(actionName(), new
>> Class[] {
>> JSONObject.class } );
>>
>> try {
>> JSONObject jsonResponse = (JSONObject)
>> action.invoke(parent(), new
>> JSONObject(inputString));
>>
>> response.setContent(jsonResponse.toString());
>> response.setHeader("application/json",
>> "content-type");
>>
>> } catch (Exception e) {
>> e.printStackTrace();
>> }
>>
>>
>> return response;
>> }
>>
>>
>>
>> }
>>
>> Basically the idea in this component is to bind the name of an action
>> in the parent component that accepts a JSONObject as the argument.
>>
>> When rendering the main HTML response for that page this component
>> generates a url which when called will looked for a request paramater
>> called "data" which it expects to be JSON data. It will then turn that
>> into a JSON object and invoke a method in the parent component that
>> match the name of the "actionName" binding. It expects that this
>> method takes a JSONObject as the only parameter. In that method you
>> can do whatever you need but the return value should also be a
>> JSONObject and then that result is returned as the content of the
>> response.
>>
>> This is a very basic component and is just to illustrate one way it
>> can be done. You would want to clean it up if you actually use it in
>> production. It doesn't do anything cleaver for you but can allow you
>> to send JSON data back and forth to a WOComponent from JS in your
>> page.
>>
>> Other ways include creating a direct action to return the JSON data
>> for the EXT grid. This is simpler but has the problem that it is
>> outside your component.
>>
>> Ext can be very heavy weight and require a lot of files to be
>> downloaded to the client browser. It's also likes things to be done in
>> the *Ext Way* which can sometimes be a pain. Although the widgets are
>> very nice... . It does work with WO but you do need to do a bit of
>> work.
>>
>> HTH
>>
>> John
>>
>>
>> On Fri, Sep 4, 2009 at 11:16 AM, Gustavo
>> Pizano<
email@hidden> wrote:
>> > Hello,.. Well after almost giving up on my requirement to put more than
>> > one
>> > column in a wobrowser to have multiple selections. I remind that before
>> > I
>> > did some little work with EXTJS. It has what we need. a GRID
>> > extjsComponent.. :D:D.. now how do I integrate WO and EXTJS?
>> > In the example of grid they are loading data from an array of arrays,
>> > and
>> > configuring "hard-coded" all the grid. How can I from the JS ask the WO
>> > server for the data to congifure the grid? is it possible?..
>> > another approach I saw was to generate a hidden WORepetition and
>> > generate
>> > all the data, then form the JS get the element and create the grid, but
>> > this
>> > approach I don't like it, becuase if I need another grid somewhere else
>> > I
>> > have to do all again, I want to reuse code.
>> > Another approach is to load the data form an xml, the same, grid has a
>> > url:
>> > attribute I fetch the xml there, so in th backend I will need to
>> > generate
>> > the xml, keep it there, while EXTJS via the url: ask for it.. what comes
>> > to
>> > my mind are security stuff... and some theoretical stuff like:
>> > How WO knows that the JS that its requesting is valid for the session
>> > in
>> > the WO application?.
>> > I think this is about the request-n-response loop... isn't it?
>> >
>> > So.. any advice... help, clue, light, code?
>> > G.
>> >
>> > _______________________________________________
>> > Do not post admin requests to the list. They will be ignored.
>> > Webobjects-dev mailing list (
email@hidden)
>> > Help/Unsubscribe/Update your Subscription:
>> >
>> >
>> > This email sent to
email@hidden
>> >
>
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (
email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to
email@hidden