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
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.
http://www.telerik.com/help/aspnet-ajax/grid-clear-selected-items.html
Please check the attached sample page. It is working properly on my end.
Greetings,
Nikolay
the Telerik team
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....
Could you please try to replicate the error on the project supplied by me in the previous post?
Greetings,
Nikolay
the Telerik team
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.
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.
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
In which version is the fix? I'm using version 2010.2.713.
Regards,
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
<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();
}
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
Please disregard my question above -- the method .clearSelectedItems is not the issue, but rather the wrong tool for the job.
Thanks -
Kevin