PDA

View Full Version : [CLOSED] Expand / Collapse Grid group in client side - Razor



MTSI
Aug 30, 2012, 8:41 AM
Hi,

http://examples2.ext.net/#/GridPanel/Miscellaneous/Grouping/

I want to achieve this in client side script.

Thanks in advance.

Daniil
Aug 30, 2012, 12:43 PM
Hi,

There is a client side Listener of this Button.

Example

<ext:Button
ID="btnToggleGroups"
runat="server"
Text="Expand/Collapse Groups"
Icon="TableSort"
Style="margin-left: 6px;">
<Listeners>
<Click Handler="#{Grouping1}[#{Grouping1}.expanded ? 'collapseAll' : 'expandAll'](); #{Grouping1}.expanded = !#{Grouping1}.expanded;" />
</Listeners>
</ext:Button>

MTSI
Aug 30, 2012, 12:53 PM
Hi,

There is a client side Listener of this Button.

Example

<ext:Button
ID="btnToggleGroups"
runat="server"
Text="Expand/Collapse Groups"
Icon="TableSort"
Style="margin-left: 6px;">
<Listeners>
<Click Handler="#{Grouping1}[#{Grouping1}.expanded ? 'collapseAll' : 'expandAll'](); #{Grouping1}.expanded = !#{Grouping1}.expanded;" />
</Listeners>
</ext:Button>

I used this but it is not working. please provide some other solution. Which will workable in Razor view not normal one.

Thanks in advance.

Daniil
Aug 30, 2012, 1:01 PM
But it works well in the sample.

Please provide your test case.

MTSI
Aug 30, 2012, 1:26 PM
But it works well in the sample.

Please provide your test case.

This is my code.




rategridtoolbaritems.Add(
Html.X().Button()
.Text("Expand/Collapse Groups")
.ID("ExpandCollapseGroupsbutton")
.Icon(Ext.Net.Icon.TableSort)
.Listeners(expanbutton =>
{
//expanbutton.Click.Handler = "javascript:clickExpand()";
expanbutton.Click.Handler = "App.Grouping1[App.Grouping1.expanded ? 'collapseAll' : 'expandAll'](); App.Grouping1.expanded = !App.Grouping1.expanded;";
})


Ext.Net.Grouping grp = new Ext.Net.Grouping();
grp.ID = "Grouping1";
grp.HideGroupedHeader = true;
grp.StartCollapsed = true;

Daniil
Aug 30, 2012, 1:51 PM
Is there any JavaScript error?

Please call

alert(App.Grouping1);
within the Click Handler.

What does it show?

MTSI
Aug 31, 2012, 5:44 AM
Is there any JavaScript error?

Please call

alert(App.Grouping1);
within the Click Handler.

What does it show?

It shows [object object]

Daniil
Aug 31, 2012, 5:53 AM
Then, I think, the code that you posted should work. Please provide a full sample to reproduce. We will do our best to investigate.

MTSI
Aug 31, 2012, 12:52 PM
Then, I think, the code that you posted should work. Please provide a full sample to reproduce. We will do our best to investigate.

Hi,

It is working fine. you can close this thread.

Thanks.