PDA

View Full Version : [CLOSED] Set actionMethods of AJAXProxy



T3rryChan
Apr 23, 2012, 2:58 PM
Hi,

I have the code below to load data of the chart from a remote data source. It is developed in asp.net mvc3 + razor view engine.
It is working fine, but the only problem is that the data is loaded through GET not POST. I am sure that the ajaxproxy has a actionmethods property, but I am not sure how to set the value of the property. Any help is appreciated.




@Html.X().Panel().Title("Area Chart").Width(800).Height(600).Layout("FitLayout").TopBar(topBar => topBar.Add(Html.X().Toolbar().Items(items =>
{
items.Add(Html.X().Button().Text("Reload Data").Icon(Icon.ArrowRefresh).Listeners(listener =>
{ listener.Click.Handler = "#{Store1}.reload();"; }));
items.Add(Html.X().Button().Text("Animate").Icon(Icon.ShapesManySelect).EnableToggle(true).P ressed(true).Listeners(listeners =>
{
listeners.Toggle.Handler = "#{Chart1}.animate = pressed ? {easing: 'ease', duration: 500} : false;";
}));
}))).Items(items =>
{
items.Add(Html.X().Chart().ID("Chart1").StyleSpec("background: #fff").Legend(true).Animate(true).Store(store => store.Add(Html.X().Store().ID("Store1").Model(model => model.Add(Html.X().Model().Fields(fields =>
{
fields.Add(Html.X().ModelField().Name("Name"));
fields.Add(Html.X().ModelField().Name("Data1"));
fields.Add(Html.X().ModelField().Name("Data2"));
fields.Add(Html.X().ModelField().Name("Data3"));
fields.Add(Html.X().ModelField().Name("Data4"));
fields.Add(Html.X().ModelField().Name("Data5"));
fields.Add(Html.X().ModelField().Name("Data6"));
fields.Add(Html.X().ModelField().Name("Data7"));
}))).Proxy(proxy => proxy.Add(Html.X().AjaxProxy().Url(Url.Action("GetData","Home")).Reader(reader => reader.Add(
Html.X().JsonReader().Root("data")
)))))).Axes(axes =>
{
axes.Add(Html.X().NumericAxis().Fields(new string[] {"Data1", "Data2", "Data3", "Data4", "Data5", "Data6", "Data7"}).Title("Number of Hits").Minimum(0).GridConfig(new AxisGrid() { Odd = new SpriteAttributes() {Opacity = 1, Fill = "#ddd", Stroke = "#fff", StrokeWidth = 1}}));
axes.Add(Html.X().CategoryAxis().Position(Position .Bottom).Fields(new string[]{"Name"}).Title("Month of the Year").Grid(true).Label(new AxisLabel() { Rotate = new RotateAttribute() {Degrees = 315}}));
}).Series(series => series.Add(Html.X().AreaSeries().Axis(Position.Rig ht).XField(new string[] {"Name"}).YField(new string[] {"Data1", "Data2", "Data3", "Data4", "Data5", "Data6", "Data7"}).Style(new SpriteAttributes() {Opacity = 0.93}))));
})

Daniil
Apr 23, 2012, 3:17 PM
Hi,

This way:

Example

.Proxy(proxy => proxy.Add(Html.X().AjaxProxy()
.ActionMethods(methods =>
methods.Read = HttpMethod.GET
)
)
)

T3rryChan
Apr 23, 2012, 3:20 PM
Hi,

This way:

Example

.Proxy(proxy => proxy.Add(Html.X().AjaxProxy()
.ActionMethods(methods =>
methods.Read = HttpMethod.GET
)
)
)

Got an exception: CS1061: 'Ext.Net.AjaxProxy.Builder' does not contain a definition for 'ActionMethods' and no extension method 'ActionMethods' accepting a first argument of type 'Ext.Net.AjaxProxy.Builder' could be found (are you missing a using directive or an assembly reference?)

Daniil
Apr 23, 2012, 4:10 PM
It has been already fixed in SVN, please update.

The Ext.NET v2 SVN:
http://svn.ext.net/premium/branches/2.0

T3rryChan
Apr 23, 2012, 4:49 PM
It has been already fixed in SVN, please update.

The Ext.NET v2 SVN:
http://svn.ext.net/premium/branches/2.0

Thanks a lot. Just wondering, when will this update available through NuGet (The last updated date of the current package is Mar 8th, 2012).

Daniil
Apr 23, 2012, 7:08 PM
The Beta 2 release should appear very soon.