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

[Solved] Still no answer?????? Please help.

1 Answer 133 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Andrew
Top achievements
Rank 1
Andrew asked on 15 May 2009, 11:51 AM
Please answer my question,  as how to accomplish the below items.

1.) For the grid below, I don't allow the user to select Master table items, only select (via clientsidecheckbox) the detail table items. When the Master is expanded I select the detail items, then I do  a postback, the items are persisted and still checked. BUT, when I unexpand the items, do the postback, and then expand the items, the items are no longer checked. WHY? How can I make sure that the DETAIL Table items are selected after the master has been expanded, closed, postback occurs, then expanded again.


 2.) I believe Telerik should correct this issue. You should be able to click a row without it affecting the rest of the other rows.

If the row clicked is already selected, the it should deselect that row (only), and vice versa, if it's deselected already then it should select that row only.

I CAN'T STAND IT when I have selected 20 rows and then when I accidently click outside a checkbox, I loose all my selections. I have the following radgrid, please show me if there is a way, how to achieve this. I already tried the ToggleSelection.js solution, but I get alot of errors because it was not designed for Heirarchy Grid.


var

 

rccoc_selected = {};

 

 

function rgChildObjects_GridCreated(sender, args) {

 

 

var scrollArea = sender.GridDataDiv;

 

 

var dataHeight = sender.get_masterTableView().get_element().clientHeight;

 

 

if (dataHeight < 200) {

 

scrollArea.style.height = dataHeight +

"px";

 

}

 

else {

 

 

//sender.get_masterTableView().get_element().style.width = "620px";

 

}

}

 

function rgChildObjects_RowSelected(sender, args) {

 

 

var customeID = args.getDataKeyValue("ReportingColumnID");

 

 

 

if (!rccoc_selected[customeID]) {

 

rccoc_selected[customeID] =

true;

 

}

}

 

function rgChildObjects_RowDeselected(sender, args) {

 

 

var customeID = args.getDataKeyValue("ReportingColumnID");

 

 

if (rccoc_selected[customeID]) {

 

rccoc_selected[customeID] =

null;

 

}

}

 

function rgChildObjects_RowCreated(sender, args) {

 

 

var customeID = args.getDataKeyValue("ReportingColumnID");

 

 

if (rccoc_selected[customeID]) {

 

 

alert(args.get_gridDataItem());

args.get_gridDataItem().set_selected(

true);

 

}

}

 

//***************************************//

 

 

function rgChildObjects_RowSelecting(sender, args) {

 

 

var e = args.get_domEvent();

 

 

//IE - srcElement, Others - target

 

 

var targetElement = e.srcElement || e.target;

 

 

 

//this condition is needed if multi row selection is enabled for the grid

 

 

if (typeof (targetElement) != "undefined") {

 

 

//is the clicked element an input checkbox? <input type="checkbox"...>

 

 

if (targetElement.tagName.toLowerCase() != "input" &&

 

(!targetElement.type || targetElement.type.toLowerCase() !=

"checkbox"))// && currentClickEvent)

 

{

 

//cancel the event

 

args.set_cancel(

true);

 

}

}

 

else

 

 

args.set_cancel(

true);

 

}

 

function rgChildObjects_RowDeselecting(sender, args) {

 

 

var e = args.get_domEvent();

 

 

//IE - srcElement, Others - target

 

 

var targetElement = e.srcElement || e.target;

 

 

 

//this condition is needed if multi row selection is enabled for the grid

 

 

if (typeof (targetElement) != "undefined") {

 

 

//is the clicked element an input checkbox? <input type="checkbox"...>

 

 

if (targetElement.tagName.toLowerCase() != "input" &&

 

(!targetElement.type || targetElement.type.toLowerCase() !=

"checkbox"))// && currentClickEvent)

 

{

 

//cancel the event

 

args.set_cancel(

true);

 

}

}

 

else

 

args.set_cancel(

true);

 

}



 

<telerik:RadGrid ID="rgChildObjects" AllowMultiRowSelection="true" AutoGenerateColumns="false" Width="295px" runat="server">

 

 

 

 

<MasterTableView HierarchyDefaultExpanded="false" HierarchyLoadMode="client" Name="ChildObjects" DataKeyNames="ReportingChildObjectID">

 

 

 

 

<DetailTables>

 

 

 

 

<telerik:GridTableView Name="Columns" Width="100%" ShowHeader="true" DataKeyNames="ReportingColumnID">

 

 

 

 

<Columns>

 

 

 

 

<telerik:GridClientSelectColumn />

 

 

 

 

<telerik:GridBoundColumn HeaderStyle-Font-Bold="true" itemstyle-wrap="false" UniqueName="DefaultDescription" DataField="DefaultDescription" HeaderText="Child Report Column(s)" />

 

 

 

 

</Columns>

 

 

 

 

</telerik:GridTableView>

 

 

 

 

</DetailTables>

 

 

 

 

<Columns>

 

 

 

 

<telerik:GridBoundColumn ItemStyle-font-bold="true" HeaderStyle-Font-Bold="true" HeaderStyle-wrap="false" UniqueName="ChildObjectName" DataField="ChildObjectName" HeaderText="Child Reports" />

 

 

 

 

</Columns>

 

 

 

 

</MasterTableView>

 

 

 

 

<ClientSettings AllowExpandCollapse="true">

 

 

 

 

 

<Selecting EnableDragToSelectRows="false" AllowRowSelect="true" />

 

 

 

 

</ClientSettings>

 

 

 

 

</telerik:RadGrid>

1 Answer, 1 is accepted

Sort by
0
Sebastian
Telerik team
answered on 18 May 2009, 02:06 PM
Hello Andrew,

Straight onto your points:

  1. How to persist the client selection/checked state of checkboxes residing in template columns on operations which trigger implicit rebind action you can see from the help article linked below:

    http://www.telerik.com/help/aspnet-ajax/grid-persist-selected-rows-client-sorting-paging-grouping-filtering.html
    http://www.telerik.com/help/aspnet-ajax/gridpersistcheckboxstateingridtemplatecolumnonrebind.html
  2. Please review my reply from the discussion in the other forum thread you participated in:
    http://www.telerik.com/community/forums/aspnet-ajax/grid/check-box-behaviour-on-grid.aspx

I would also like to inform you that the forum entries are with 72 hours response time and we guarantee that 95% of them are answered either by the Telerik Support Staff or a community member (as explained in the general forums usage sticky threads).

In case you would like to receive messages based on your support package, consider posting your inquiries in our support ticketing system.

Kind regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
Andrew
Top achievements
Rank 1
Answers by
Sebastian
Telerik team
Share this question
or