PDA

View Full Version : [CLOSED] Selection of specific checkbox column in grid firing Select listener of Selection model



alscg
Apr 17, 2013, 11:59 AM
Hi,

In one of my page I am using cascading drop down grid as below



<script src="../../Scripts/jquery-1.7.1.min.js" type="text/javascript"></script>
<script src="../../Scripts/MicrosoftMvcAjax.debug.js" type="text/javascript"></script>
<script src="../../Scripts/MicrosoftAjax.debug.js" type="text/javascript"></script>
<script type="text/javascript">

var GetLinkedHierarchies = function () {
var goalId = '@( Session["GoalID"])';
if (goalId != '') {
jQuery.ajax({
url: '@( Url.Action("GetLinkedHierarchies", "Talent"))',
type: "POST",
data: {
"goalId": goalId
},
dataType: "json",
success: OnLinkedHierarchiesLoaded,
Error: OnServerError
});
}
};

function OnLinkedHierarchiesLoaded(data) {
if (data.DEPTS != null) {
// Select current goal's regions
var regionRecords = [];
for (i = 0; i < data.REGION.length; ++i) {
var regionID = data.REGION[i];
if (regionID != null && regionID > 0) {
regionRecords.push(App.grdRegion.getStore().getByI d(regionID))
}
}
App.grdRegion.getSelectionModel().select(regionRec ords);

// Store current goal's business units temporarly
var selBusinessUnitIds = "";
for (i = 0; i < data.BU.length; ++i) {
var buID = data.BU[i];
if (buID != null && buID > 0) {
selBusinessUnitIds += buID + ",";
}
}
App.hdnSelBusinesUnitIds.value = selBusinessUnitIds;

// Store current goal's depts temporarly
var selDeptds = "";
for (i = 0; i < data.DEPTS.length; ++i) {
var deptID = data.DEPTS[i].Organization_Id;
if (deptID != null && deptID > 0) {
selDeptds += deptID + ",";
}
}
App.hdnSelDeptIds.value = selDeptds;

// Now load Business Units Grid
SetSelectedRegionIds();

App.hdnHasDepts.value = true;
}
else {
App.hdnHasDepts.value = false;
}
}

var SelectBusinessUnits = function () {
if (App.hdnHasDepts.value == true) {
// Select current Goal's business Units
var buRecords = [];
var hdnBuIds = App.hdnSelBusinesUnitIds.value;
var BuIds = hdnBuIds.substring(0, hdnBuIds.length - 1);
BuIds = BuIds.split(",");

for (i = 0; i < BuIds.length; ++i) {
var buID = parseInt(BuIds[i]);
if (buID != null && buID > 0) {
buRecords.push(App.grdBusinessUnits.getStore().get ById(buID))
}
}
App.grdBusinessUnits.getSelectionModel().select(bu Records);

//Now load department Grid
SetSelectedBusinessUnitIds();
}
};
var SelectDepts = function () {

if (App.hdnHasDepts.value == true) {
//Select current Goal's business Units
var deptRecords = [];
var hdnDeptIds = App.hdnSelDeptIds.value;
var DeptIds = hdnDeptIds.substring(0, hdnDeptIds.length - 1);
DeptIds = DeptIds.split(",");

for (i = 0; i < DeptIds.length; ++i) {
var deptID = parseInt(DeptIds[i]);
if (deptID != null && deptID > 0) {
deptRecords.push(App.grdDepartments.getStore().get ById(deptID))
}
}
App.grdDepartments.getSelectionModel().select(dept Records);
}
};

var LinkHierarchies = function () {
if (App.grdDepartments.getSelectionModel().selected.i tems.length > 0) {
var goalId = '@(Session["GoalID"])';
var selectedDepartmentIds = "";
var selectedDepartments = App.grdDepartments.getSelectionModel().selected.it ems;

Ext.each(selectedDepartments, function (hierarchy) {
selectedDepartmentIds += hierarchy.data.Organization_Id + ",";
});

jQuery.ajax({
url: '@(Url.Action("SaveLinkedHierarchies", "Talent"))',
type: "POST",
data: {
"goalId": goalId,
"selHierarchyIds": selectedDepartmentIds
},
dataType: "json",
success: ServerSideValidationResult,
Error: OnServerError
});
}
}

function SetSelectedRegionIds() {
var selRegionIds = "";
var selectedRegions = App.grdRegion.getSelectionModel().selected.items;

Ext.each(selectedRegions, function (region) {
selRegionIds += region.data.Operating_Group_Id + ",";
});

App.hdnRegionIds.value = selRegionIds;
}

function SetSelectedBusinessUnitIds() {
var selBusinessUnitIds = "";
var selectedBusinessUnits = App.grdBusinessUnits.getSelectionModel().selected. items;

Ext.each(selectedBusinessUnits, function (BU) {
selBusinessUnitIds += BU.data.Org_Level_Id + ",";
});

App.hdnBusinesUnitIds.value = selBusinessUnitIds;
}

function ServerSideValidationResult(result) {
var newComment = result.ErrorMsg;
if (newComment != "") {
$("#ErrorMessageDiv").html(newComment);
}
else {
$("#ErrorMessageDiv").html("");
window.location.reload();
}
}

function OnServerError() {
alert("Error is occured!.");
}
</script>
<div class="linked-hierarchies clearfix">

<div id="ErrorMessageDiv" class="error-label"></div>

<div class="col">
@(Html.X().ResourceManager(ViewBag.ManagerConfig as MvcResourceManagerConfig))
@(Html.X().Hidden().ID("hdnRegionIds"))
@(Html.X().Hidden().ID("hdnBusinesUnitIds"))
@(Html.X().Hidden().ID("hdnSelBusinesUnitIds"))
@(Html.X().Hidden().ID("hdnSelDeptIds"))
@(Html.X().Hidden().ID("hdnHasDepts"))
@((Html.X().GridPanel()
.ID("grdRegion")
.Cls("grd-existing-goals")
.Border(false)
.Height(280)
.Width(210)
.Store(Html.X().Store().ID("RegionStore").Listeners(ls => ls.Load.Fn = "GetLinkedHierarchies")
.Model(Html.X().Model().ID("RegionModel")
.IDProperty("Operating_Group_Id")
.Fields(
new ModelField("Operating_Group_Id", ModelFieldType.Int),
new ModelField("Operating_Group_Desc", ModelFieldType.String)
)
)
.DataSource(Model.TheEntity)
)
.ColumnModel(
Html.X().Column().Text(Resource.Talent.LinkedHiera rchies.RegionText).Width(160).DataIndex("Operating_Group_Desc")
)
.SelectionModel(Html.X().CheckboxSelectionModel()
.Mode(SelectionMode.Multi).ID("chkSelect")
.SelectedRecordID("Operating_Group_Id")
.CheckOnly(true)
.Listeners(ls => { ls.Select.Handler = "SetSelectedRegionIds(); App.grdBusinessUnits.getStore().load()"; })
)
)
)
</div>

<div class="col">
@(Html.X().GridPanel()
.ID("grdBusinessUnits")
.Cls("grd-existing-goals")
.Border(false)
.Height(280)
.Width(210)
.Store(Html.X().Store().ID("BusinessUnitsStore").Listeners(ls => ls.Load.Fn = "SelectBusinessUnits")
.AutoLoad(false)
.Model(Html.X().Model().ID("BusinessUnitsModel")
.IDProperty("Org_Level_Id")
.Fields(
new ModelField("Org_Level_Id", ModelFieldType.Int) { Mapping = "Org_Level_Id" },
new ModelField("Org_Level_Desc", ModelFieldType.String) { Mapping = "Org_Level_Desc" }
)
)
.Proxy(Html.X().AjaxProxy()
.Url(Url.Action("GetBusinessUnits"))
.Reader(Html.X().JsonReader().Root("data"))
)
.Parameters(
ps => ps.Add(new StoreParameter("regionCSV", "App.hdnRegionIds.value", ParameterMode.Raw))
)

).EmptyText("No records found. Please select a region to see related business units")
.ColumnModel(
Html.X().Column().Text(Resource.Talent.LinkedHiera rchies.BusinessUnitsText).Width(160).DataIndex("Org_Level_Desc")
)
.SelectionModel(Html.X().CheckboxSelectionModel(). ID("chkBusinessUnitsSelect")
.Mode(SelectionMode.Multi)
.SelectedRecordID("Org_Level_Id")
.CheckOnly(true)
.Listeners(ls => { ls.Select.Handler = "SetSelectedBusinessUnitIds(); App.grdDepartments.getStore().load()"; })
)
)

</div>

<div class="col">
@(Html.X().GridPanel()
.ID("grdDepartments")
.Cls("grd-existing-goals")
.Border(false)
.Height(280)
.Width(210)
.Store(Html.X().Store().ID("DepartmentsStore").Listeners(ls => ls.Load.Fn = "SelectDepts")
.AutoLoad(false)
.Model(Html.X().Model().ID("DepartmentsModel")
.IDProperty("Organization_Id")
.Fields(
new ModelField("Organization_Id", ModelFieldType.Int) { Mapping = "Organization_Id" },
new ModelField("Organization_Cd", ModelFieldType.String) { Mapping = "Organization_Cd" }
)
)
.Proxy(Html.X().AjaxProxy()
.Url(Url.Action("GetOrganizationsByBU"))
.Reader(Html.X().JsonReader().Root("data"))
)
.Parameters(
ps => ps.Add(new StoreParameter("businessUnitCSV", "App.hdnBusinesUnitIds.value", ParameterMode.Raw))
)
)
.ColumnModel(
Html.X().Column().Text(Resource.Talent.LinkedHiera rchies.DepartmentsText).Width(160).DataIndex("Organization_Cd")
)
.SelectionModel(Html.X().CheckboxSelectionModel()
.Mode(SelectionMode.Multi).ID("chkDepartmentSelect")
.SelectedRecordID("Organization_Id")
.CheckOnly(true)

)
)
</div>

@( Html.X().LinkButton().ID("btnSave").Text(Resource.Talent.Goal.SaveButtonText)
.Cls("save button btn-Save-linkhierarchies").Listeners(ls => ls.Click.Fn = "LinkHierarchies"))

</div>
<link rel="stylesheet" href="@( Url.Content("~/Content/foundation.css"))" />
<link rel="stylesheet" href="@( Url.Content("~/Content/pages/LinkedHierarchies.css"))" />
<link rel="stylesheet" href="@( Url.Content("~/Content/page_support.css"))" />




The issue is.. while user come to this page in edit mode ..I have to maintain state of previous selection for that I am selecting previous selection rows in grid after grid is loading...But When I use below code the ajax proxy call is being called multiple times..I mean each call App.grdRegion.getSelectionModel().select() is loading grid.




function OnLinkedHierarchiesLoaded(data) {
if (data.DEPTS != null) {
// Select current goal's regions
var regionRecords = [];
for (i = 0; i < data.REGION.length; ++i) {
var regionID = data.REGION[i];
if (regionID != null && regionID > 0) {
regionRecords.push(App.grdRegion.getStore().getByI d(regionID))
}
}
App.grdRegion.getSelectionModel().select(regionRec ords);
}
}


Please suggest a way to resolve this.

Daniil
Apr 17, 2013, 1:09 PM
Hi @alscg,

Yes, the Select event fires for each selected record.

Could you clarify what kind of behavior you need in your scenario? Firing the Select event once for the last record or not firing at all or something else?

alscg
Apr 17, 2013, 2:44 PM
Hi @alscg,

Yes, the Select event fires for each selected record.

Could you clarify what kind of behavior you need in your scenario? Firing the Select event once for the last record or not firing at all or something else?

Danill,

I want to fire event only once after all records selected that have to be checked.

My Requirement as below.
I have three grids with cascading behavior. On selection of one grid's record I will bind other grid....so on. Also the selection can be multiple.this is working fine...but after saving these three grids selections when ever user come to this page, I have to show these selection and user can modify the selections. For that I want to select multiple records that user selected while adding ..
After selecting multiple records in first grid ..I want to load second grid records based on first grid and after selecting second grid ..wants to select third grid.

You can see in my code how I am passing my parameters to action methods .

Please correct me if I am wrong.

Daniil
Apr 17, 2013, 3:51 PM
Ok, clear.

I can suggest to use a locking technique.

1. Change the Select Handler.

ls.Select.Handler = "if (!this.selectLock) { SetSelectedBusinessUnitIds(); App.grdDepartments.getStore().load(); }";

2. Change the OnLinkedHierarchiesLoaded function.



var sm = App.grdRegion.getSelectionModel();

sm.selectLock = true;
sm.select(regionRecords);
sm.selectLock = false;
SetSelectedBusinessUnitIds();
App.grdDepartments.getStore().load();

alscg
Apr 18, 2013, 5:45 AM
Ok, clear.

I can suggest to use a locking technique.

1. Change the Select Handler.

ls.Select.Handler = "if (!this.selectLock) { SetSelectedBusinessUnitIds(); App.grdDepartments.getStore().load(); }";

2. Change the OnLinkedHierarchiesLoaded function.



var sm = App.grdRegion.getSelectionModel();

sm.selectLock = true;
sm.select(regionRecords);
sm.selectLock = false;
SetSelectedBusinessUnitIds();
App.grdDepartments.getStore().load();


Danill,

I am really thankful to you ...I have tried different things for 6 hours before reaching you. Now every thing working fine.
Thanks once again...

alscg
Apr 19, 2013, 5:26 AM
Danill,

I am really thankful to you ...I have tried different things for 6 hours before reaching you. Now every thing working fine.
Thanks once again...

Hi,

I need following information.

1. How to pass deselected record ID in the grid to handler?
2. what will happen in background when user deselect a record?
3. Is there locking available for deselect also...I mean as "selectLock" is there anything for deselect event?

Daniil
Apr 19, 2013, 7:25 AM
1. How to pass deselected record ID in the grid to handler?

A deselected record is passed to a Deselect listener.
http://docs.sencha.com/extjs/4.2.0/#!/api/Ext.selection.RowModel-event-deselect

You can pass it via ExtraParams.

record.getId()



2. what will happen in background when user deselect a record?


A selection model's Deselect event fires.



3. Is there locking available for deselect also...I mean as "selectLock" is there anything for deselect event?

I define the selectLock property by myself in the example. JavaScript allows such things. So, you can do the same with a "deselectLock".

alscg
Apr 19, 2013, 8:09 AM
A deselected record is passed to a Deselect listener.
http://docs.sencha.com/extjs/4.2.0/#!/api/Ext.selection.RowModel-event-deselect

You can pass it via ExtraParams.

record.getId()
A selection model's Deselect event fires.
I define the selectLock property by myself in the example. JavaScript allows such things. So, you can do the same with a "deselectLock".


Hi Danill,

As you know I am having cascading grids in my page as i mentioned in this post. With the Locking approach you suggested selection working fine in all grids. when user deselect a record in parent grid I am calling below code using deselect listener.



var RegionDeselect = function () {
SetSelectedRegionIds();
App.grdBusinessUnits.getStore().load();

}


In the above code I am loading child grid again with the current selected parent records..
in the load event of child grid I am calling below code


if (GoalBusinessUnits.length > 0) {
// Select current Goal's business units
var buRecords = [];

for (i = 0; i < GoalBusinessUnits.length; ++i) {
var buID = parseInt(GoalBusinessUnits[i]);
if (buID != null && buID > 0) {
if (App.grdBusinessUnits.getStore().getById(buID) != null) {
buRecords.push(App.grdBusinessUnits.getStore().get ById(buID));
}
}
}
var sm = App.grdBusinessUnits.getSelectionModel();
// Lock the select event in order to prevent it from firing untill all records are selected
sm.selectLock = true;
sm.select(buRecords);
sm.selectLock = false;

SetSelectedBusinessUnitIds();
App.grdDepartments.getStore().load();

}


In the above code I underlined two lines of code which will fire grand child grid load event.....On the load event of I am calling below code..But this below code is being executed multiple times..I just want to fire only once.



if (GoalDepartments.length > 0) {
//Select current Goal's departments
var deptRecords = [];

for (i = 0; i < GoalDepartments.length; ++i) {
var deptID = parseInt(GoalDepartments[i].Organization_Id);
if (deptID != null && deptID > 0) {
if (App.grdDepartments.getStore().getById(deptID) != null) {
deptRecords.push(App.grdDepartments.getStore().get ById(deptID));
}
}
}
var sm = App.grdDepartments.getSelectionModel();
// Lock the select event in order to prevent it from firing untill all records are selected
sm.selectLock = true;
sm.select(deptRecords);
sm.selectLock = false;
}

You can see that I have used locking here ,which is working fine when user comes to this page in edit mode but above mentioned code being called multiple times (Grand Child Grid load event) when ever user deselect any parent record.

Please help me in this regard.

Daniil
Apr 19, 2013, 11:19 AM
Please try to set up

.SelectionMemory(false)
for the GridPanels.

Does it help?

If no, please provide a full test case to reproduce the problem.

alscg
Apr 19, 2013, 1:14 PM
Please try to set up

.SelectionMemory(false)
for the GridPanels.

Does it help?

If no, please provide a full test case to reproduce the problem.[/QUOTE]

Hi Danill,

With this property I am unable to get the results...still grand child grid firing multiple times.

Repro steps:

1. select some records in all grids and save....after successful save state of the selections is persists as I am selecting records based on saved DB data.
2. Now deselect any record and see ...related records of current deselected record in other grids should be cleared but this is not working properly in Grand child grid the issue is this grid is being loaded multiple times.
3. If you do the step.2 , You will re produce the issue. If not try repeat step.2 one or two times .

Below is the complete view page code



<script src="../../Scripts/jquery-1.7.1.min.js" type="text/javascript"></script>
<script src="../../Scripts/MicrosoftMvcAjax.debug.js" type="text/javascript"></script>
<script src="../../Scripts/MicrosoftAjax.debug.js" type="text/javascript"></script>
<script type="text/javascript">

var GoalRegions = [];
var GoalBusinessUnits = [];
var GoalDepartments = [];

var GetLinkedHierarchies = function () {
var goalId = '@( Session["GoalID"])';
if (goalId != '') {
jQuery.ajax({
url: '@( Url.Action("GetLinkedHierarchies", "Talent"))',
type: "POST",
data: {
"goalId": goalId
},
dataType: "json",
success: OnLinkedHierarchiesLoaded,
Error: OnServerError
});
}
};

function OnLinkedHierarchiesLoaded(data) {
if (data.DEPTS != null) {
// Select current goal's regions
var regionRecords = [];

for (i = 0; i < data.REGION.length; ++i) {
var regionID = data.REGION[i];
if (regionID != null && regionID > 0) {
regionRecords.push(App.grdRegion.getStore().getByI d(regionID))
}
}

var sm = App.grdRegion.getSelectionModel();

// Lock the select event in order to prevent it from firing untill all records are selected
sm.selectLock = true;
sm.select(regionRecords);
sm.selectLock = false;

// Store current goal's regions temporarly
GoalRegions = data.REGION.slice();
// Store current goal's business units temporarly
GoalBusinessUnits = data.BU.slice();
// Store current goal's depts temporarly
GoalDepartments = data.DEPTS.slice();

SetSelectedRegionIds();
App.grdBusinessUnits.getStore().load();
}
}

var SelectBusinessUnits = function () {
if (GoalBusinessUnits.length > 0) {
// Select current Goal's business units
var buRecords = [];

for (i = 0; i < GoalBusinessUnits.length; ++i) {
var buID = parseInt(GoalBusinessUnits[i]);
if (buID != null && buID > 0) {
if (App.grdBusinessUnits.getStore().getById(buID) != null) {
buRecords.push(App.grdBusinessUnits.getStore().get ById(buID));
}
}
}
var sm = App.grdBusinessUnits.getSelectionModel();
// Lock the select event in order to prevent it from firing untill all records are selected
sm.selectLock = true;
sm.select(buRecords);
sm.selectLock = false;

SetSelectedBusinessUnitIds();
App.grdDepartments.getStore().load();

}
};

var SelectDepts = function () {
if (GoalDepartments.length > 0) {
//Select current Goal's departments
var deptRecords = [];

for (i = 0; i < GoalDepartments.length; ++i) {
var deptID = parseInt(GoalDepartments[i].Organization_Id);
if (deptID != null && deptID > 0) {
if (App.grdDepartments.getStore().getById(deptID) != null) {
deptRecords.push(App.grdDepartments.getStore().get ById(deptID));
}
}
}
var sm = App.grdDepartments.getSelectionModel();
// Lock the select event in order to prevent it from firing untill all records are selected
sm.selectLock = true;
sm.select(deptRecords);
sm.selectLock = false;
}
};

var RegionDeselect = function () {
SetSelectedRegionIds();
var sm = App.grdBusinessUnits.getSelectionModel();
//sm.deselectLock = true;
App.grdBusinessUnits.getStore().load();
//sm.deselectLock = false;
}

var BusinessUnitDeselect = function () {
SetSelectedBusinessUnitIds();
var sm = App.grdDepartments.getSelectionModel();
//sm.deselectLock = true;
App.grdDepartments.getStore().load();
//sm.deselectLock = false;
}

var LinkHierarchies = function () {
if (App.grdDepartments.getSelectionModel().selected.i tems.length > 0) {
var goalId = '@(Session["GoalID"])';
var selectedDepartmentIds = "";
var selectedDepartments = App.grdDepartments.getSelectionModel().selected.it ems;

Ext.each(selectedDepartments, function (hierarchy) {
selectedDepartmentIds += hierarchy.data.Organization_Id + ",";
});

jQuery.ajax({
url: '@(Url.Action("SaveLinkedHierarchies", "Talent"))',
type: "POST",
data: {
"goalId": goalId,
"selHierarchyIds": selectedDepartmentIds
},
dataType: "json",
success: ServerSideValidationResult,
Error: OnServerError
});
}
}

function SetSelectedRegionIds() {
var selRegionIds = "";
var selectedRegions = App.grdRegion.getSelectionModel().selected.items;

Ext.each(selectedRegions, function (region) {
selRegionIds += region.data.Operating_Group_Id + ",";
});

App.hdnRegionIds.value = selRegionIds;
}

function SetSelectedBusinessUnitIds() {
var selBusinessUnitIds = "";
var selectedBusinessUnits = App.grdBusinessUnits.getSelectionModel().selected. items;

Ext.each(selectedBusinessUnits, function (BU) {
selBusinessUnitIds += BU.data.Org_Level_Id + ",";
});

App.hdnBusinesUnitIds.value = selBusinessUnitIds;
}

function ServerSideValidationResult(result) {
var newComment = result.ErrorMsg;
if (newComment != "") {
$("#ErrorMessageDiv").html(newComment);
}
else {
$("#ErrorMessageDiv").html("");
window.location.reload();
}
}

function OnServerError() {
alert("Error is occured!.");
}
</script>
<div class="linked-hierarchies clearfix">

<div id="ErrorMessageDiv" class="error-label"></div>

<div class="col">
@(Html.X().ResourceManager(ViewBag.ManagerConfig as MvcResourceManagerConfig))
@(Html.X().Hidden().ID("hdnRegionIds"))
@(Html.X().Hidden().ID("hdnBusinesUnitIds"))
@((Html.X().GridPanel()
.ID("grdRegion")
.Cls("grd-existing-goals")
.Border(false)
.Height(280)
.Width(210)
.SelectionMemory(false)
.Store(Html.X().Store().ID("RegionStore").Listeners(ls => ls.Load.Fn = "GetLinkedHierarchies")
.Model(Html.X().Model().ID("RegionModel")
.IDProperty("Operating_Group_Id")
.Fields(
new ModelField("Operating_Group_Id", ModelFieldType.Int),
new ModelField("Operating_Group_Desc", ModelFieldType.String)
)
)
.DataSource(Model.TheEntity)
)
.ColumnModel(
Html.X().Column().Text(Resource.Talent.LinkedHiera rchies.RegionText).Width(160).DataIndex("Operating_Group_Desc")
)
.SelectionModel(Html.X().CheckboxSelectionModel()
.Mode(SelectionMode.Multi).ID("chkSelect")
.SelectedRecordID("Operating_Group_Id")
.CheckOnly(true)
.Listeners(ls =>
{
ls.Select.Handler = "if (!this.selectLock) { SetSelectedRegionIds(); App.grdBusinessUnits.getStore().load();}";
ls.Deselect.Handler = " if (!this.deselectLock) { RegionDeselect();}";
}
)
)
)
)
</div>

<div class="col">
@(Html.X().GridPanel()
.ID("grdBusinessUnits")
.Cls("grd-existing-goals")
.Border(false)
.Height(280)
.Width(210)
.SelectionMemory(false)
.Store(Html.X().Store().ID("BusinessUnitsStore").Listeners(ls => ls.Load.Fn = "SelectBusinessUnits")
.AutoLoad(false)
.Model(Html.X().Model().ID("BusinessUnitsModel")
.IDProperty("Org_Level_Id")
.Fields(
new ModelField("Org_Level_Id", ModelFieldType.Int) { Mapping = "Org_Level_Id" },
new ModelField("Org_Level_Desc", ModelFieldType.String) { Mapping = "Org_Level_Desc" }
)
)
.Proxy(Html.X().AjaxProxy()
.Url(Url.Action("GetBusinessUnits"))
.Reader(Html.X().JsonReader().Root("data"))
)
.Parameters(
ps => ps.Add(new StoreParameter("regionCSV", "App.hdnRegionIds.value", ParameterMode.Raw))
)

).EmptyText("No records found. Please select a region to see related business units")
.ColumnModel(
Html.X().Column().Text(Resource.Talent.LinkedHiera rchies.BusinessUnitsText).Width(160).DataIndex("Org_Level_Desc")
)
.SelectionModel(Html.X().CheckboxSelectionModel(). ID("chkBusinessUnitsSelect")
.Mode(SelectionMode.Multi)
.SelectedRecordID("Org_Level_Id")
.CheckOnly(true)
.Listeners(ls =>
{
ls.Select.Handler = "if (!this.selectLock){ SetSelectedBusinessUnitIds(); App.grdDepartments.getStore().load(); }";
ls.Deselect.Handler = " if (!this.deselectLock) { BusinessUnitDeselect();}";
}
)
)
)

</div>

<div class="col">
@(Html.X().GridPanel()
.ID("grdDepartments")
.Cls("grd-existing-goals")
.Border(false)
.Height(280)
.Width(210)
.SelectionMemory(false)
.Store(Html.X().Store().ID("DepartmentsStore").Listeners(ls => ls.Load.Fn = "SelectDepts")
.AutoLoad(false)
.Model(Html.X().Model().ID("DepartmentsModel")
.IDProperty("Organization_Id")
.Fields(
new ModelField("Organization_Id", ModelFieldType.Int) { Mapping = "Organization_Id" },
new ModelField("Organization_Cd", ModelFieldType.String) { Mapping = "Organization_Cd" }
)
)
.Proxy(Html.X().AjaxProxy()
.Url(Url.Action("GetOrganizationsByBU"))
.Reader(Html.X().JsonReader().Root("data"))
)
.Parameters(
ps => ps.Add(new StoreParameter("businessUnitCSV", "App.hdnBusinesUnitIds.value", ParameterMode.Raw))
)
)
.ColumnModel(
Html.X().Column().Text(Resource.Talent.LinkedHiera rchies.DepartmentsText).Width(160).DataIndex("Organization_Cd")
)
.SelectionModel(Html.X().CheckboxSelectionModel()
.Mode(SelectionMode.Multi).ID("chkDepartmentSelect")
.SelectedRecordID("Organization_Id")
.CheckOnly(true)
)
)
</div>

@( Html.X().LinkButton().ID("btnSave").Text(Resource.Talent.Goal.SaveButtonText)
.Cls("save button btn-Save-linkhierarchies").Listeners(ls => ls.Click.Fn = "LinkHierarchies"))

</div>
<link rel="stylesheet" href="@( Url.Content("~/Content/foundation.css"))" />
<link rel="stylesheet" href="@( Url.Content("~/Content/pages/LinkedHierarchies.css"))" />
<link rel="stylesheet" href="@( Url.Content("~/Content/page_support.css"))" />



Even though I have used locking concept and
SelectionMemory(false) property on all grids....last grid is still being executed multiple times. see the attachment below.

6072[QUOTE=Daniil;107489]

Daniil
Apr 19, 2013, 4:16 PM
Unfortunately, I can't run the sample. It throws errors.