Wednesday 15 August 2012

javascript - Gridpanel prepare submenu -



javascript - Gridpanel prepare submenu -

i having issues prepare function. trying select delete button able disable/enable it. code select first item (which dropdown group). trying select first item within group.

var preparerecruiter = function (grid, toolbar, rowindex, record) { var dropdown = toolbar.items.get(0); dropdown.setdisabled(true); };

i tried multiple variations along lines of toolbar.items.get(0).get(0); , toolbar.items.items.get(0); without success.

how select delete button can disable it?

i have next code gridcommand:

<ext:commandcolumn runat="server" width="35" sortable="false" fixed="true" meta:resourcekey="commandcolumnresource2" id="ctl2108"> <commands> <ext:gridcommand icon="applicationform"> <menu enablescrolling="false"> <items> <ext:menucommand text="delete" icon="applicationformdelete" commandname="delete" meta:resourcekey="deletecommandresource1" /> <ext:menucommand text="disable" icon="applicationformdisable" commandname="disable" /> <ext:menucommand text="enable" icon="applicationformenable" commandname="enable" /> </items> </menu> </ext:gridcommand> </commands> <preparetoolbar fn="preparerecruiter" /> <listeners> <command fn="redcommand" /> </listeners> </ext:commandcolumn>

thank you!

you should utilize "button.menu" access menu's items.

example

<%@ page language="c#" %> <script runat="server"> protected void page_load(object sender, eventargs e) { if (!x.isajaxrequest) { store store = this.gridpanel1.getstore(); store.datasource = new object[] { new object[] { "test", "test" }, new object[] { "test", "test" }, new object[] { "test", "test" } }; } } </script> <!doctype html> <html> <head runat="server"> <title>ext.net v2 example</title> <script> var preparetoolbar = function (grid, toolbar, rowindex, record) { var btn = toolbar.items.get(0); btn.menu.items.get(0).disable(); }; </script> </head> <body> <form runat="server"> <ext:resourcemanager runat="server" /> <ext:gridpanel id="gridpanel1" runat="server"> <store> <ext:store runat="server"> <model> <ext:model runat="server"> <fields> <ext:modelfield name="test1" /> <ext:modelfield name="test2" /> </fields> </ext:model> </model> </ext:store> </store> <columnmodel runat="server"> <columns> <ext:column runat="server" text="test 1" dataindex="test1" /> <ext:column runat="server" text="test 2" dataindex="test2" /> <ext:commandcolumn runat="server" width="35"> <commands> <ext:gridcommand icon="applicationform"> <menu> <items> <ext:menucommand text="delete" commandname="delete" /> <ext:menucommand text="disable" commandname="disable" /> <ext:menucommand text="enable" commandname="enable" /> </items> </menu> </ext:gridcommand> </commands> <preparetoolbar fn="preparetoolbar" /> </ext:commandcolumn> </columns> </columnmodel> </ext:gridpanel> </form> </body> </html>

javascript extjs ext.net

No comments:

Post a Comment