View Full Version : LiveSearch gridpanel plugin without statusbar

Apr 14, 2020, 12:15 PM
Hi, i am following this example https://examples5.ext.net/#/GridPanel/Plugins/LiveSearch/, but i dont see a way to display the number of matches on a tag inside the liveseach control, and dont need a statusbar control for it

Apr 14, 2020, 3:36 PM
Hello @ibambino!

The Live Search Grid Panel component requires a status bar as it will look for one in the grid to automatically update the status of it. So, the customization you want is not supported "out of the box".

This is not the best way to do this but the simplest way to show how modifying the component is the way to go for what you need. This will aplly if and only if all you want is to reflect what would be output to the statusbar somewhere else, say, in a Label component in the live panel's toolbar (next to the search bar).

For that, given the example you pointed:

1. Add a simple label within the ext:LiveSearchToolbar's Items block:

<ext:Label runat="server" ID="Label1" Text="Nothing Found" />

2. Wire up the status bar's setStatus() method to change the label:

<ext:StatusBar runat="server" DefaultText="Nothing Found" Hidden="true">
<ext:ConfigItem Name="setStatus" Value="function(value) { App.Label1.setText(value.text); }" Mode="Raw" />

Notice also we set the toolbar as "hidden". It will be there, just not drawn to the page.

Then every time the live status grid panel plugin finds the status bar and call its setStatus() command, it will relay the text to the Label component you added to the upper toolbar.

The proper way to handle this though would either be by overriding or extending the component to introduce the new behavior; you'll probably want to update the Ext.ux.LiveSearchToolbar component.

Overriding would benefit of being able to use the same server-side interface for the ext:LiveSearchToolbar and ext:LiveSearchGridPanel components, but (where the override is applied) will affect the component wherever it is used.

Extending will allow you to keep the original component untouched but you'd need also to extend the server-side component for either (or both, depending on the change of behavior from the extension) component.

Following the override or extension path may be a challenging endeavor but would open a world of possibilities for you with all Ext.NET components, making any scenario you may think of virtually possible with Ext.NET, taking advantage of all the features it brings in.

As a side note, I've noticed the Listeners in the ext:LiveSearchGridPanel component are not being triggered and logged issue #1764 (https://github.com/extnet/Ext.NET/issues/1764) to track and correct the defect.

Hope this helps!

Apr 14, 2020, 6:25 PM
Fabricio, thank you very much, I will try to extend it.