-
24 Aug 2009 5:51 AM #81
Two Routers
Two Routers
When adding another handler in the same namespace, I have been foiled by the built in caching. Turn off the caching, or reset IIS. Maybe that can help.
Dave W
-
25 Aug 2009 2:16 AM #82
Can somebody let me know which is the latest Router Version?
Thanks in Advance
Thomson
-
25 Aug 2009 2:58 AM #83
Latest "official" code is in post #1 (the 0.6 version)
My latest code with the additions I've mentioned in this thread, which I don't believe the Ext team has had time to evaluate and include, are in this message:
http://extjs.com/forum/showthread.ph...222#post366222
Or on my site at:
http://vulgrin.com/DavesExtDirectBranch.zip
because someone had a problem unzipping the version I uploaded.
I would have started a new thread for my "branch" but the changes aren't all that different and I'd rather they just get included in the original code. There was talk about setting up a google code for it, and if someone at Ext wants to do that then I'll happily seed it with my latest copy to eliminate confusion.
D
-
25 Aug 2009 4:21 AM #84
Hello All,
I have tried using the router version 6 i have tried calling a function using Ext.Direct
In firebug i can see there is a post happening to the handler and immediately i am getting the
uncaught exception: Ext.data.DataProxy: DataProxy attempted to execute an API-action but found an undefined url / function. Please review your Proxy url/api-configuration.
I am loading the store using the following code
The Response will be having a Result attribute which having my json, How do i tell the reader to take only thatCode:var mystore = new Ext.data.DirectStore({ paramsAsHash: false, root: 'Rows', api: { load: MyApp.Sample.GetOrder('labelle') }, //directFn: , idProperty: 'id', autoLoad: true, fields: [ { name: 'id' }, { name: 'name' } ], listeners: { load: function(s, records) { Ext.MessageBox.alert("Information", "Loaded " + records.length + " records"); }, beforeload: function(t, params) { Ext.MessageBox.alert(t); }, exception: function(current, action, rs, params) { Ext.MessageBox.alert(action); } } }); var grid = new Ext.grid.GridPanel({ store:mystore, cm: new Ext.grid.ColumnModel([ new Ext.grid.RowNumberer(), { header: "+/-", width: 120, sortable: true, dataIndex: 'id' }, { header: "Sel", width: 70, sortable: true, dataIndex: 'name' }, ]), viewConfig: { forceFit: true } });
Thanks in Advance
Thomson
-
25 Aug 2009 6:37 AM #85
I don't understand the "api" property you have on your directstore. Here's an example of one of mine:
This calls a method that gathers up the note objects and then packs them into a custom JSON object that I use in my C# code. The method returns that, which gets turned into the JSON below and sent back to the browser.Code:noteStore: new Ext.data.DirectStore({ directFn : Note.GetNotes, idProperty : 'NoteId', root : 'notes', fields : ["NoteId", "ShortText", "NoteText", "Updated", "Username"] }),
(I'm not using 0.6 btw, I'm using my branch of it, so I don't use ParamsAsHash, etc.)Code:{"type":"rpc","tid":5,"action":"Note","method":"GetNotes", "result": {"total":2,"notes":[{"ShortText":"test note asdf asfasdf","NoteId":7295,"SampleId":21704,"NoteText":"test note asdf asfasdf","Updated":new Date(1250429820000),"Username":"dsanders"}, {"ShortText":"booga","NoteId":7296,"SampleId":21704,"NoteText":"booga","Updated":new Date(1250429820000),"Username":"dsanders"}]}}]
-
25 Aug 2009 8:27 PM #86
Hello Sanders,
Can you send me a sample of your code using the Ext.Direct version of yours
Thanks
Thomson
-
25 Aug 2009 8:47 PM #87
Hello Sanders,
Can u give an example using Dave ExtBranch, I just replaced your dll in the router 6 , now its complaining of missing DirectHandler
Thanks
Thomson
-
26 Aug 2009 7:10 AM #88
FYI, I think there is a bug in the sample. The sample is setting the response content type to "text/javascript". This is fine for the majority of the operations, but it makes Ext.Direct throw up parsing errors when you try to do a file upload. In the sample, here are the two lines:
I took out the assignment in my code and it seems to be working all around - so I think this was an unnecessary step anyway. Will report back if its not.Code:private const string DirectHandlerContentType = "text/javascript"; ... context.Response.ContentType = DirectHandlerContentType;
What's funny is that the third form of the sample (the one where you upload an image file) was failing silently. The file would get uploaded to the code, but if you notice, the callback code never ran. Just escaped notice until now I guess.
D
-
26 Aug 2009 10:20 AM #89
To Mark: (mbajema)
Concerning your ComplexObjectConverter code from waaaay back on post #57, there is a bug. In ReadArray, those should really be If...else if...else statements, not separate Ifs.
I found a bug where if you are sending in an array of vars from the client, it was adding on a null object to the list of parameters in Request Data. This was making the processor blow up because it would be looking for the wrong number of arguments to pass to the DirectMethod. If you change the function to read like this, the problem goes away:
CheersCode:private object[] ReadArray(JsonReader reader) { ArrayList output = new ArrayList(); while (reader.Read()) { if (reader.TokenType == JsonToken.EndArray) { return output.ToArray(); } else if (reader.TokenType == JsonToken.StartArray) { output.Add(ReadArray(reader)); } else if (reader.TokenType == JsonToken.StartObject) { output.Add(ReadObject(reader)); } else { output.Add(reader.Value); } } throw new JsonReaderException(); }
D
-
27 Aug 2009 11:13 AM #90



Reply With Quote
The examples given in the Direct Pack from Ext should work with my branch of Ext.Direct. My code doesn't change the interfaces, it just adds some features as listed in posts #44, #45 and #46 of this thread.