This is a migrated thread and some comments may be shown as answers.

RadToolBar Clear button issues

2 Answers 48 Views
ToolBar
This is a migrated thread and some comments may be shown as answers.
Somnath
Top achievements
Rank 1
Somnath asked on 06 Jul 2012, 01:02 PM
I have radgrid and radtoolbar. To filter grid based on column I have added radtoolbar items viz filter:on, off and clear.

When I enter some text in filter column text area and try to clear it using "clear" button from tool bar my code behind code is doing it but its taking time to clear the text. The loading panel is shown and then it goes off and after sometime the filter text areas gets cleared.

"That mean there is delay in actual render (cleared text areas) and loading panel show time"

foreach

 

 

(GridColumn column in grdA.MasterTableView.Columns)

 

{

column.CurrentFilterFunction =

 

GridKnownFunction.NoFilter;

 

column.CurrentFilterValue =

 

string.Empty;

 

}

grdA.MasterTableView.FilterExpression =

 

string.Empty;

 

grdA.DataSource = AccountSummaryList;

grdA.DataBind();

I tried to show the "loading panel" using RadAjaxManager request start and responce end but its not showing the loading panel. I did this on Master page;

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" >
<ClientEvents OnRequestStart="RequestStart" OnResponseEnd="ResponseEnd" />
</telerik:RadAjaxManager>

<script type="text/javascript">
            var currentLoadingPanel = null;
            var currentUpdatedControl = null;
            function RequestStart(sender, eventArgs) {
                                if (eventArgs != undefined) {
                    var initControl = eventArgs.get_eventTarget();
                    if (initControl == 'ctl00$cph1$myToolBar') {
                        currentLoadingPanel = $find("<%= lp1.ClientID %>"); //ajax loading lanel
                        currentUpdatedControl = $find("<%= cph1.ClientID %>"); //content panel 
                        if (currentLoadingPanel != null) {
                            currentLoadingPanel.hide(currentUpdatedControl);
                        }
                        currentLoadingPanel.show(currentUpdatedControl);
                    }
                }
            }
            function ResponseEnd(sender, eventArgs) {
                if (currentLoadingPanel != null) {
                    currentLoadingPanel.hide(currentUpdatedControl);
                }
                currentUpdatedControl = null;
                currentLoadingPanel = null;
            }
        </script>

Even after doing this there is delay in actual clear and loading panel show.

other things I tried ; are I added autopostback on toolbar - no use.

One this which is working for me but has issue is;

On client click of toolbar I am calling client function and clearing like this -

 

 

 

<script type="text/javascript">

 

 

 

 

 

 

 

 

function OnClientButtonClicked(sender, args) {

 

 

 

var button = args.get_item();

 

 

 

var txt = button.get_text();

 

 

 

if (txt == 'Clear') {

 

 

 

var masterTable = $find("<%= grdA.ClientID %>").get_masterTableView();

 

 

 

var columns = masterTable.get_columns();

 

 

 

for (var i = 0; i < columns.length; i++) {

 

 

 

var column = columns[i];

 

masterTable.filter(column._data.UniqueName,

 

"", Telerik.Web.UI.GridFilterFunction.StartsWith, true);

 

}

 

 

}

}

 

 

</script>

 

The above function is doing well. The problem with above code is whenever I typr something in filter text area of one column and try to type something in other filter couln it throws JS error as attached in this post.

If I change above code to ;

 

 

masterTable.filter("Location", "", Telerik.Web.UI.GridFilterFunction.StartsWith, true); // coulmn name

it is not throwing any error., but doesn't work fine.

Please let me know what is the issue with this code?

And for my entire problem if there are any other ways to do it?


2 Answers, 1 is accepted

Sort by
0
Somnath
Top achievements
Rank 1
answered on 09 Jul 2012, 08:01 AM
One observation.

On RadGrid for the column which has AutoPostBackOnFilter="true" clear does not clear the data from filters immediatly after loading panel goes off. It takes time to clear.

Where as if you don't have this attribute set it clear perfectly.

But when we dont have AutoPostBackOnFilter="true" then we have to show filter icon by setting ShowFilterIcon="true".

But this is not acceptable as it doesn't look intuitive from users perspective to have to choose from filter menu instead of just return press.

Is there any solution for this?


0
Radoslav
Telerik team
answered on 11 Jul 2012, 07:04 AM
Hello Somnath,

Could you please elaborate a bit more on your scenario?  Do you ajaxify the RadGrid and if it is, could you please post the corresponding ajax settings. Also on which event do you clear the filters text? Also how do you bind the RadGrid control, do you use Advanced DataBinding or  Declarative DataSources (please note that a simple binding does not support filtering) ?
Also could you please confirm that you set the Skin to the RadAjaxLoadingPanel control? For example:
<telerik:RadAjaxLoadingPanel runat="server" Skin="Default"></telerik:RadAjaxLoadingPanel>
Additionally it will be helpful if you could post your aspx page markup with the related code behind file. Thus we will be able to get more information about your scenario and provide you more to the point answer.

Looking forward for your reply.

All the best,
Radoslav
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
ToolBar
Asked by
Somnath
Top achievements
Rank 1
Answers by
Somnath
Top achievements
Rank 1
Radoslav
Telerik team
Share this question
or