We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

GridGroupingControl Hierarchy child refresh

With a Hierarchy in the grid how can I refresh a granchild relation where items have been added/deleted through ajax calls in the background?

For example in the ThreeLevelHierarchies sample if an item was added to the GrandChild DataTable how can I just refresh that part of the grid without a full postback and have the same items expanded?


3 Replies

TL Truman Lackey February 8, 2012 06:39 PM UTC

Figured this out doing the following:

Client side:

var addError = { 'Method': 'add', 'id': id};
__doPostBack('<%= UpdatePanel.ClientID.ToString() %>', JSON.stringify(addError));

Server side:

helper class:
public class Method
{
public String Method { get; set; }
public int ElementErrorID { get; set; }
}

in aspx.cs file:

private void RefreshGrid(Method method)
{

Syncfusion.Grouping.Table myTable = this.ScenariosGridGrouping.Table.RelatedTables["Parent"].RelatedTables["Child"];

if (method.Method == "add")
{
var item = (from items in pdc.dat_ElementErrors where errors.ElementError_ID == elementErrorMethod.ElementErrorID select errors).Single();
ElementErrorRepository.ErrorView errorView = new Pontoon.Models.ElementErrorRepository.ErrorView(elementErrorMethod.ElementErrorID, error.ElementError_Name, error.Scenario_Crew_ElementRating_ID, error.br_Scenario_Crew_Element_ElementRating.Element_ID);
errorTable.SourceList.Add(errorView);
}
else if (elementErrorMethod.Method == "delete")
{
ElementErrorRepository.ErrorViewList errorList = ( ElementErrorRepository.ErrorViewList)errorTable.SourceList;
var error = (from errors in errorList where errors.ElementError_ID == elementErrorMethod.ElementErrorID select errors).Single();
errorTable.SourceList.Remove(error);
}




TL Truman Lackey February 8, 2012 06:48 PM UTC

Last entry posted on accident without full listing.

Figured this out doing the following:

Client side:

var addError = { 'Method': 'add', 'ID': id};
__doPostBack('<%= UpdatePanel.ClientID.ToString() %>', JSON.stringify(addError));

Server side:
Im my case I am using sql to linq and the underlying source is obtained from a ling query and is a BindingList and it is getting set when the initial page post is made and also setting the relations in the TableDescriptors.

ItemRepository is a sql to linq wrapper class that inherits from BindingList. This is important as the SourceList for the Grouping.Table will not update the underlying records if it is not a BindingList<>

helper class:
public class Method
{
public String Method { get; set; }
public int ID { get; set; }
}

in aspx.cs file:

private void RefreshGrid(Method method)
{
DataContext dc = new DataContext();
Syncfusion.Grouping.Table itemTable = this.ScenariosGridGrouping.Table.RelatedTables["Parent"].RelatedTables["Child"];

if (method.Method == "add")
{
ItemRepository.ItemView itemView = new ItemRepository.ItemView(method.ID);
itemTable.SourceList.Add(itemView);
}





SN Sridhar N Syncfusion Team February 13, 2012 12:31 PM UTC

Hi Truman,

Thanks for your interest in Syncfusion products.

We are sorry for the inconvenience caused. Currently we don't have ajax call for editing in Hierarchy grid. Could you please send us your sample so that we can analyze it and find your exact requirement and provide solution. The information provided will be great help in resolving issue.

Please let us know if any concerns.

Regards,
Sridhar N


Loader.
Live Chat Icon For mobile
Up arrow icon