var
selected = {};
function
dgGrid_RowSelected(sender, args) {
var
cpayID = args.getDataKeyValue(
"ID"
);
if
(!selected[cpayID]) {
selected[cpayID] =
true
;
}
}
function
dgGrid_RowDeselected(sender, args) {
var
cpayID = args.getDataKeyValue(
"ID"
);
if
(selected[cpayID]) {
selected[cpayID] =
false
;
}
}
function
dgGrid_RowCreated(sender, args) {
var
cpayID = args.getDataKeyValue(
"ID"
);
if
(selected[cpayID]) {
args.get_gridDataItem().set_selected(
true
);
}
}
function
dgGrid_Created(sender, eventArgs) {
var
masterTable = sender.get_masterTableView(),
headerCheckBox = $telerik.$(masterTable.HeaderRow).find(
":checkbox"
)[0];
if
(headerCheckBox) {
headerCheckBox.checked = masterTable.get_selectedItems().length == masterTable.get_pageSize();
}
}
9 Answers, 1 is accepted
0
Hello Peter,
Thank you for contacting us.
The corresponding help article has been recently updated. Please use the changed GridCreated function and let me know about the result:
http://www.telerik.com/help/aspnet-ajax/grid-persist-selected-rows-client-sorting-paging-grouping-filtering.html
Looking forward to your reply.
Regards,
Eyup
Telerik
Thank you for contacting us.
The corresponding help article has been recently updated. Please use the changed GridCreated function and let me know about the result:
http://www.telerik.com/help/aspnet-ajax/grid-persist-selected-rows-client-sorting-paging-grouping-filtering.html
Looking forward to your reply.
Regards,
Eyup
Telerik
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 the blog feed now.
0
Peter
Top achievements
Rank 1
answered on 27 Sep 2013, 12:06 PM
I got this error:
Uncaught TypeError: Property `$` of object [object Object] is not a function
From this line:
var headerCheckBox = $(selectColumn.get_element()).find("[type=checkbox]")[0];
I thought the line should be:
var headerCheckBox = $telerik.$(selectColumn.get_element()).find("[type=checkbox]")[0];
But I get this error:
Your code assumes JQuery is present with the page, not just in the telerik controls.
I tried using this line with my original Created function, but it had no effect on the original issue.
headerCheckBox.checked = masterTable.get_selectedItems().length == masterTable.get_dataItems().length;
Uncaught TypeError: Property `$` of object [object Object] is not a function
From this line:
var headerCheckBox = $(selectColumn.get_element()).find("[type=checkbox]")[0];
I thought the line should be:
var headerCheckBox = $telerik.$(selectColumn.get_element()).find("[type=checkbox]")[0];
But I get this error:
Uncaught TypeError: Cannot call method `get_element` of null
Your code assumes JQuery is present with the page, not just in the telerik controls.
I tried using this line with my original Created function, but it had no effect on the original issue.
headerCheckBox.checked = masterTable.get_selectedItems().length == masterTable.get_dataItems().length;
0
Hi Peter,
You can refer to the following code library to verify that the approach works as expected. Can you please run the sample provided in the link and instruct us the exact steps to reproduce the issue?
http://www.telerik.com/community/code-library/aspnet-ajax/grid/get-selected-items-through-all-pages.aspx
Regards,
Eyup
Telerik
You can refer to the following code library to verify that the approach works as expected. Can you please run the sample provided in the link and instruct us the exact steps to reproduce the issue?
http://www.telerik.com/community/code-library/aspnet-ajax/grid/get-selected-items-through-all-pages.aspx
Regards,
Eyup
Telerik
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 the blog feed now.
0
Peter
Top achievements
Rank 1
answered on 02 Oct 2013, 11:54 AM
The checkboxes themselves work fine. Again here is my problem:
1. Multi items showing in a grid.
2. Select the checkbox on the first row at least.
3. Click a column header to sort the grid.
4. The "Select All" checkbox is now checked.
1. Multi items showing in a grid.
2. Select the checkbox on the first row at least.
3. Click a column header to sort the grid.
4. The "Select All" checkbox is now checked.
0
Hi Peter,
Can you please verify that you have replaced SelectColumnID from the function with the unique name of the ClientSelectColumn?
Regards,
Eyup
Telerik
Can you please verify that you have replaced SelectColumnID from the function with the unique name of the ClientSelectColumn?
Regards,
Eyup
Telerik
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 the blog feed now.
0
Peter
Top achievements
Rank 1
answered on 07 Oct 2013, 01:16 PM
I made the changes as demonstrated in the example and I got the same results when following these steps:
The checkboxes themselves work fine. Again here is my problem:
1. Multi items showing in a grid.
2. Select the checkbox on the first row at least.
3. Click a column header to sort the grid.
4. The "Select All" checkbox is now checked.
The checkboxes themselves work fine. Again here is my problem:
1. Multi items showing in a grid.
2. Select the checkbox on the first row at least.
3. Click a column header to sort the grid.
4. The "Select All" checkbox is now checked.
0
Hi Peter,
I have created a sample RadGrid web site to test the described behavior. On my side the sorting and selection preserving is working correctly upon following the exact provided steps. Can you please run the attached application and verify that it works as expected from your end, too?
Regards,
Eyup
Telerik
I have created a sample RadGrid web site to test the described behavior. On my side the sorting and selection preserving is working correctly upon following the exact provided steps. Can you please run the attached application and verify that it works as expected from your end, too?
Regards,
Eyup
Telerik
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 the blog feed now.
0
Peter
Top achievements
Rank 1
answered on 10 Oct 2013, 12:07 PM
The database 'C:\INETPUB\WWWROOT\TESTINGSITES\TELERIKSUPPORT\GRIDCHECKBOXESSORT\APP_DATA\NORTHWIND.MDF' cannot be opened because it is version 655. This server supports version 612 and earlier. A downgrade path is not supported.
Could not open new database 'C:\INETPUB\WWWROOT\TESTINGSITES\TELERIKSUPPORT\GRIDCHECKBOXESSORT\APP_DATA\NORTHWIND.MDF'. CREATE DATABASE is aborted.
An attempt to attach an auto-named database for file C:\inetpub\wwwroot\TestingSites\TelerikSupport\GridCheckboxesSort\App_Data\Northwind.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
You are running a newer version of SQLExpress, than I have.
0
Peter
Top achievements
Rank 1
answered on 10 Oct 2013, 12:22 PM
I applied the updated javascript again to my page, and I must have missed something before.
Now it works as expected.
Now it works as expected.