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

grid.clearSelectedItems()

13 Answers 151 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bill
Top achievements
Rank 2
Bill asked on 27 Jul 2010, 12:38 AM
Anyone get this method to work?

I keep getting Object doesn't support this property or method - though I can see the method in the list for the grid I'm trying to clear in the javascript debugger...


        function UnCheckAll() {
            var grid = $find("rgGroupEmail");
           grid.clearSelecteItems();
        }
 
the rgGroupEmail grid exists, getting the grid in a var -  gridSelectedItems.length returns 274...

13 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 27 Jul 2010, 05:52 AM
Hello,


You should call the clearSelectedItems() method with respect to GridTableView client object. Here is the example.

Client code:
function clearSelectedRecords()
{
 var grid = $find("< %= RadGrid1.ClientID %>");
 grid.get_masterTableView().clearSelectedItems();
}


-Shinu.
0
Bill
Top achievements
Rank 2
answered on 27 Jul 2010, 06:13 AM
0
Nikolay Rusev
Telerik team
answered on 27 Jul 2010, 08:01 AM
Hello Bill,

Please check the attached sample page. It is working properly on my end.

Greetings,
Nikolay
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Bill
Top achievements
Rank 2
answered on 27 Jul 2010, 06:19 PM
Nope - still getting the object doesn't support this property or method error.
It does clear the selected items count.

My grid has a gridclientselectcolumn - is that the problem?

I know - the column has a select/deselect all checkbox at the top - the customer insists that there be a separate
button to clear the column....
0
Nikolay Rusev
Telerik team
answered on 30 Jul 2010, 09:29 AM
Hello Bill,

Could you please try to replicate the error on the project supplied by me in the previous post?

Greetings,
Nikolay
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Tonino
Top achievements
Rank 1
answered on 06 Sep 2010, 09:10 AM
Hi Nicolay

I changed your example a bit to so that I have a postback. In the code behind I call the javascript to clear the row selection. Doing so I get the exception "Microsoft JScript runtime error: 'this._owner._selection' is null or not an object" after pressing the button labled "ClearWithPostback".

What am I doing wrong?

I there a way to remove the selection in code behind without rebinding the grid?

Regards,
Tonino.
0
Princy
Top achievements
Rank 2
answered on 07 Sep 2010, 10:37 AM
Hello Tonino,

You can simply clear the selected items in the grid from code behind using the ClearSelectedItems() method.

C#:
protected void clearwithPostBack_Click(object sender, EventArgs e)
   {
     RadGrid1.MasterTableView.ClearSelectedItems(); // clears the selected item
   }

Thanks,
Princy.
0
Nikolay Rusev
Telerik team
answered on 07 Sep 2010, 11:26 AM
Hello Tonino,

There was issue with clearSelectedItems method of RadGrid client-side in previous version of RadControls for ASP.NET AJAX. I suggest you to try latest version. Calling the client method from server will not change anything.

Regards,
Nikolay
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Tonino
Top achievements
Rank 1
answered on 07 Sep 2010, 11:56 AM
Hi Nikolay

In which version is the fix? I'm using version 2010.2.713.

Regards,
Tonino.
0
Sebastian
Telerik team
answered on 07 Sep 2010, 12:32 PM
Hi Tonino,

The latest official version of RadControls for ASP.NET AJAX is 2010.2.826 (Q2 2010 SP1). Please migrate to it using the steps from here and let us know how it goes.

Best regards,
Sebastian
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Michael
Top achievements
Rank 1
answered on 30 Jan 2013, 03:40 PM
If you hook this up to a RadGrid event like Client-Settings-ClientEvents-OnRowDropped in the mark-up

<telerik:RadGrid ID="RadGrid" ClientSettings-ClientEvents-OnRowDropped="removeSelection"...

then you'll get passed the event target which will give you a properly scoped reference to the respective grid and MasterTableView object

 

function removeSelection(e) {

 

var masterTable = e.MasterTableView;

masterTable.clearSelectedItems();

}

0
Kevin
Top achievements
Rank 1
answered on 24 Apr 2017, 10:31 PM

I reviewed the code sample and it looks good, but when I follow that in my code, .clearSelectedItems executes without any runtime error, but it just doesn't do anything:

            var grid = $find('<%=radSearchResults.ClientID %>')
            if (grid)
            {
                grid.clearSelectedItems();
            }

I have the following config setting present in my ASPX page:

    <telerik:RadGrid ID="radSearchResults" runat="server" DataSourceID="innovation">
        <GroupingSettings CollapseAllTooltip="Collapse all groups"></GroupingSettings>
        <MasterTableView DataSourceID="innovation">
        </MasterTableView>
        <ClientSettings>
            <Selecting AllowRowSelect="true" />
        </ClientSettings>
    </telerik:RadGrid>

I checked the debugger in IE11, and the AllowRowSelect attribute is present for my RadGrid and set to true -- this is when I drill-down to RadGrid > ClientSettings > Selecting > AllowRowSelect. 

What can I do to fix this?

Thank you -

Kevin

0
Kevin
Top achievements
Rank 1
answered on 25 Apr 2017, 03:09 PM

Please disregard my question above -- the method .clearSelectedItems is not the issue, but rather the wrong tool for the job.

Thanks -

Kevin

Tags
Grid
Asked by
Bill
Top achievements
Rank 2
Answers by
Shinu
Top achievements
Rank 2
Bill
Top achievements
Rank 2
Nikolay Rusev
Telerik team
Tonino
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Sebastian
Telerik team
Michael
Top achievements
Rank 1
Kevin
Top achievements
Rank 1
Share this question
or