PDA

View Full Version : [CLOSED] PartialExtView Button Listener



Timothy
May 04, 2012, 3:01 PM
Hello,

The following example appears to be rendering an incorrect response:




syntax error
[Break On This Error]


...ete User\"}]}]</Ext.Net.RazorItems>"].join(''));Ext.net.addTo("TabSetupUser", )






{script:"Ext.net.append(Ext.getBody(),[\"<Ext.Net.RazorItems>[{border:false,xtype:\\\"panel\\\",items:[{html:\\\"\\\\r\\\\n\\\\t\\\\t\\\\t\\\\t<h2>Users</h2>\\\\r\\\\n\\\\t\\\\t\\\\t\\\\t<p>Use the following section to manage the <i>Users</i> on the application:</p>\\\\r\\\\n\\\\t\\\\t\\\\t\\\",xtype:\\\"container\\\"},{store:{model:Ext.define(Ext.id(), {extend: \\\"Ext.data.Model\\\", fields:[{name:\\\"Id\\\"},{name:\\\"FirstName\\\",type:\\\"string\\\"},{name:\\\"LastName\\\",type:\\\"string\\\"},{name:\\\"Email\\\"}] }),storeId:\\\"Users\\\",autoLoad:true,proxy:{type:\\\"ajax\\\",reader:{type:\\\"json\\\",idProperty:\\\"Id\\\",root:\\\"data\\\"},url:\\\"/Management/User/Get\\\"},pageSize:10},height:250,plugins:[{ptype:\\\"rowediting\\\"}],xtype:\\\"grid\\\",bbar:{xtype:\\\"pagingtoolbar\\\",displayInfo:true,store:\\\"Users\\\"},title:\\\"Users\\\",iconCls:\\\"#Group\\\",columns:{items:[{flex:1,dataIndex:\\\"Email\\\",text:\\\"Email\\\"}]}}],buttons:[{id:\\\"id21f034400d7b7e70\\\",width:90,iconCls:\\\"#UserAdd\\\",scale:\\\"medium\\\",text:\\\"Add User\\\",listeners:{click:{buffer:300,fn:function(item,e){ \",\"alert('Word');\",\"}}}},{id:\\\"btnEditUser\\\",disabled:true,width:90,iconCls:\\\"#UserEdit\\\",scale:\\\"medium\\\",text:\\\"Edit User\\\"},{id:\\\"btnDeleteUser\\\",disabled:true,width:100,iconCls:\\\"#UserDelete\\\",scale:\\\"medium\\\",text:\\\"Delete User\\\"}]}]</Ext.Net.RazorItems>\"].join(''));Ext.net.addTo(\"TabSetupUser\", );"}




@(Html.X().Panel()
.Border(false)
.Items(a =>
{
a.Add(Html.X().Container()
.Html(@"
<h2>Users</h2>
")
);
a.Add(Html.X().GridPanel()
.Icon(Icon.Group)
.Height(250)
.Title("Users")
.Store(store =>
store.Add(Html.X().Store()
.ID("Users")
.PageSize(10)
.Model(model =>
model.Add(Html.X().Model()
.Fields(fields =>
{
fields.Add(Html.X().ModelField()
.Name("Id")
);
fields.Add(Html.X().ModelField()
.Name("FirstName")
.Type(ModelFieldType.String)
);
fields.Add(Html.X().ModelField()
.Name("LastName")
.Type(ModelFieldType.String)
);
fields.Add(Html.X().ModelField()
.Name("Email")
);
} )
)
)
.Proxy(proxy =>
proxy.Add(Html.X().AjaxProxy()
.Reader(reader =>
reader.Add(Html.X().JsonReader()
.IDProperty("Id")
.Root("data")
)
)
.Url(Url.Action("Get", "User", new { Area = "Management" } ) )
)
)
)
)
.BottomBar(bar =>
bar.Add(Html.X().PagingToolbar()
.StoreID("Users")
)
)
.ColumnModel(model =>
{
model.Add(Html.X().Column()
.DataIndex("Email")
.Flex(1)
.Text("Email")
);
} )
.Plugins(plugins =>
{
plugins.Add(Html.X().RowEditing());
} )
);
} )
.Buttons(buttons =>
{
buttons.Add(Html.X().Button()
.Icon(Icon.UserAdd)
.Scale(ButtonScale.Medium)
.Text("Add User")
.Width(90)
.Listeners(listeners =>
{
listeners.Click.Buffer = 300;
listeners.Click.Handler = @"
alert('Word');
";
} )
);
buttons.Add(Html.X().Button()
.ID("btnEditUser")
.Disabled(true)
.Icon(Icon.UserEdit)
.Scale(ButtonScale.Medium)
.Text("Edit User")
.Width(90)
);
buttons.Add(Html.X().Button()
.ID("btnDeleteUser")
.Disabled(true)
.Icon(Icon.UserDelete)
.Scale(ButtonScale.Medium)
.Text("Delete User")
.Width(100)
);
} )
)


Remove the following and it works great:



listeners.Click.Handler = @"
alert('Word');
";


Cheers,
Timothy

Vladimir
May 04, 2012, 3:39 PM
Fixed in SVN (regex was not marked as SingleLine therefore dot was not considered as any symbol)

Timothy
May 04, 2012, 3:47 PM
Confirmed, thanks!

Cheers,
Timothy