Quantcast
Channel: DevExpress Support Center (Examples)
Viewing all 7205 articles
Browse latest View live

How to: Merge Bars When They are Used in Standard Controls

$
0
0

This example demonstrates the merging behavior of bars when they are used in controls that don't support automatic merging.

The example creates a TabControl in which a Tab contains three MainMenuControls:
1) an empty menu called 'elementHost',
2) a menu with 'Cut', 'Copy' and 'Paste' commands,
3) a menu with 'Left', 'Center' and 'Right' commands.
The second and third MainMenuControls will be merged to the first MainMenuControl.

The merging feature is enabled with the ElementMergingBehavior property attached to the Tab. This property is set to 'InternalWithInternal', which means that the Tab's internal elements are merged with other internal elements that are defined in parent name scopes. 
The 'elementHost' MainMenuControl belongs to the name scope inherited from the Window object (a name scope is implicitly created for each Window object). The IsScopeOwner properties set for the second and third MainMenuControls define child name scopes. Thus, these MainMenuControls will be merged to the 'elementHost' MainMenuControl (defined in the parent name scope).

Note:
If you want to merge the Tab's second and third MainMenuControls to the Window's topmost MainMenuControl (the one that contains 'File', 'Settings' and 'Exit' commands), replace the Tab's property setting:
dxb:MergingProperties.ElementMergingBehavior="InternalWithInternal"
with:
dxb:MergingProperties.ElementMergingBehavior="InternalWithExternal"


GridView - How to edit in memory data source

$
0
0

This example illustrates how to bind the MVC GridView Extension with an in memory datasource (List<T>) with enabled editing capabilities.

For Validation:
Make sure that you have met the following requirements:
- The Model's Properties have related Data Annotations attributes.
- The GridView's PartialView is wrapped with a form tag/container.
- The client-side/unobtrusive validation is enabled (for example, at the Web.config level).
- The related scripts are linked manually or loaded automatically by setting the embedRequiredClientLibraries configuration option to true.

See Also:
E3530: How to bind GridView with standard in-memory data sources (DataTable, List<T>)
E3998: GridView - How to specify a custom EditForm Template

Online Demo:
Edit Modes

How to trigger an action when the user clicks an icon within the appointment

$
0
0
This example illustrates how to handle the SchedulerControl's MouseUp event and use the SchedulerViewInfoBase.CalcHitInfo method to determine the visual element being clicked.  If an appointment is hit, the method returns the AppointmentViewInfo object. To obtain the element under the mouse cursor, the AppointmentViewInfo.Items collection is analyzed. The coordinates provided by the Bounds property of a collection item are mapped to the coordinate system used in mouse events and subsequently compared with the cursor position.


How to bind a Chart dashboard item to data in code

$
0
0

The following example demonstrates how to bind a Chart dashboard item to data in code.

Question Comments

Added By: faezeh eshraghi at: 2/16/2016 7:41:16 AM    what is 
nwindDataSetTableAdapters.SalesPersonTableAdapter()???
we have to use what instead of this??
please help me

OBSOLETE - Date Range Filtering in the Filter Row

$
0
0

UPDATED:

Starting with version v2015 vol 2 (v15.2), this functionality is available out of the box. Simply set the GridViewDataColumn.SettingsHeaderFilter.Mode property to DateRangePicker to activate it. Please refer to the ASP.NET Grid View - Data Range Filter, Adaptivity and More (Coming soon in v15.2) blog post and the Date Range Header Filter demo for more information.
If you have version v15.2+ available, consider using the built-in functionality instead of the approach detailed below.


For Older Versions:

This example illustrates how to specify a column's FilterTemplate by using two ASPxDateEdit controls and use them for date range filtering:
- Enter the start and end date values;
- Call the client-side ASPxClientGridView.AutoFilterByColumn method and pass the target column's FieldName and entered values as parameters;
- Handle the server-side ASPxGridView.ProcessColumnAutoFilter event;
- Check if the currently processed column (e.Column.FieldName) is the target one. If so, retrieve the passed value (e.Value) and create data range filter criteria (e.Criteria) using the approach illustrated in the Create the Custom Filter Criteria example.

See Also:
E2203: CheckComboBox filtering in the Auto Filter Row
E1950: OBSOLETE - ASPxGridView - Date Auto Filter
E5038: GridView - How to implement date range filtering using a custom editor in the AutoFilterRow

ASPxGridView - How to customize RowFilter in DataDateColumn and provide two ASPxDateEdit controls that allow setting a date range as a filter expression

Question Comments

Added By: Gunnar Steinn Magnússon at: 8/24/2012 9:03:41 AM    

Could you please post a suggested way to do implement this with MVCxGridView?

Added By: esa s at: 7/29/2013 6:46:41 AM    

hi, in this sample by clicking twice on the Apply button (without changing dates), the dateSelector control would not be loaded and it will cause an exception in your gridview, would you please check this ? thanks

OBSOLETE - ASPxGridView - Date Auto Filter

$
0
0

UPDATED:

Starting with version v2015 vol 2 (v15.2), this functionality is available out of the box. Simply set the GridViewDataColumn.SettingsHeaderFilter.Mode property to DateRangePicker to activate it. Please refer to the ASP.NET Grid View - Data Range Filter, Adaptivity and More (Coming soon in v15.2) blog post and the Date Range Header Filter demo for more information.
If you have version v15.2+ available, consider using the built-in functionality instead of the approach detailed below.


For Older Versions:

This example demonstrates how to create an ASPxComboBox filter with "today", "yesterday" and other filtering options

See Also:
CheckComboBox filtering in the Auto Filter Row
E1990: OBSOLETE - Date Range Filtering in the Filter Row

Question Comments

Added By: Amith Shetty 2 at: 3/24/2014 1:45:15 PM    

In the example, if i have only one record which has yesterdays day and I pick a filter of "last week", when the grid is rendered, the filter on top says "yesterday" due to the following executing first in grid_ProcessColumnAutoFilter. Is there a workaround for this?

else if (value >= start.AddDays(-1.0) &&
                value <= end.AddMilliseconds(-1.0))
                e.Value = "Yesterday";

Added By: Daniel Meltzer at: 12/17/2014 6:35:25 AM    

The sample provided via the Run Online option generates an error when selecting from the filter dropdown.

Added By: Gosha (DevExpress Support) at: 12/17/2014 11:01:12 AM    

Hello,

Yes, I see this behavior and I created a separate ticket on your behalf, T188556: The E1950 sample provided via the Run Online option generates an error when selecting from the filter dropdown, regarding this issue.

OBSOLETE - ASPxGridView - How to implement a custom HeaderFilter with a calendar for a date column

$
0
0

UPDATED:

Starting with version v2015 vol 2 (v15.2), this functionality is available out of the box. Simply set the GridViewDataColumn.SettingsHeaderFilter.Mode property to DateRangePicker to activate it. Please refer to the ASP.NET Grid View - Data Range Filter, Adaptivity and More (Coming soon in v15.2) blog post and the Date Range Header Filter demo for more information.
If you have version v15.2+ available, consider using the built-in functionality instead of the approach detailed below.


For Older Versions:

This example illustrates how to create a custom HeaderFilter for a date column. The main steps are: 
1) create a custom HeaderTemplate  to prevent default header filter button logic and implement custom one;
2) use ASPxPopupControl to display a Calendar and several additional filters. ASPxFormLayout is used to build a layout;
3) use the client AutoFilterByColumn method to perform filtering from the client side and  the ASPxClientGridView.PerformCallback method to pass a complex filter expression to the server to implement custom filtering;
4) process a custom callback in the ASPxGridView.CustomCallback event handler to get information about the required filter expression on the server;
5) implement the approach described in the ASPxGridView - How to programmatically change the column's filter in the FilterExpression  help article to apply a new filter.

Click on the "Model Date" column to check how this works.

MVC:
T152511: OBSOLETE - GridView - How to implement a custom HeaderFilter with a calendar for a date column

OBSOLETE - GridView - How to implement a custom HeaderFilter with a calendar for a date column

$
0
0

UPDATED:

Starting with version v2015 vol 2 (v15.2), this functionality is available out of the box. Simply set the MVCxGridViewColumn.SettingsHeaderFilter.Mode property to DateRangePicker to activate it. Please refer to the ASP.NET Grid View - Data Range Filter, Adaptivity and More (Coming soon in v15.2) blog post and the Date Range Header Filter demo for more information.
If you have version v15.2+ available, consider using the built-in functionality instead of the approach detailed below.


For Older Versions:
 This example illustrates how to create a custom HeaderFilter for a date column. The main steps are: 

1) create a custom HeaderTemplate using the  SetHeaderTemplateContent method to prevent default header filter button logic and implement a custom one;
2) use the PopupControl to display a Calendar and several additional filters. FormLayout is used to build  a layout;
3) use the client AutoFilterByColumn method to perform filtering from the client side and the MVCxClientGridView.PerformCallback  method to pass a complex filter expression to the server to implement custom filtering;;
4) process a custom callback in the action method defined using the CustomActionRouteValues property and pass information about the current filter command to a partial view;
5) assign a delegate method to the BeforeGetCallbackResult property and implement the approach described in the ASPxGridView - How to programmatically change the column's filter in the FilterExpression  help article  to apply a new filter.

Click on the "Model Date" column to check how this works.

Web Forms:
T153163: OBSOLETE - ASPxGridView - How to implement a custom HeaderFilter with a calendar for a date column


OBSOLETE - GridView - How to implement date range filtering using a custom editor in the AutoFilterRow

$
0
0

UPDATED:

Starting with version v2015 vol 2 (v15.2), this functionality is available out of the box. Simply set the MVCxGridViewColumn.SettingsHeaderFilter.Mode property to DateRangePicker to activate it. Please refer to the ASP.NET Grid View - Data Range Filter, Adaptivity and More (Coming soon in v15.2) blog post and the Date Range Header Filter demo for more information.
If you have version v15.2+ available, consider using the built-in functionality instead of the approach detailed below.


For Older Versions:

This example demonstrates how to implement date range filtering in the GridView extension.
Use the MVCxGridViewColumn.SetFilterTemplateContent  method to create a custom editor and assign a delegate method to the GridViewSettings.ProcessColumnAutoFilter property to process a custom filter expression sent from the client side.

See Also:
E1990: OBSOLETE - Date Range Filtering in the Filter Row

Question Comments

Added By: Gustavo Sainz at: 11/11/2014 11:08:43 AM    

I can't make it to work, as the ProcessColumnAutoFilter does not trigger when settings the grid to use

 settings.CustomBindingRouteValuesCollection.Add(GridViewOperationType.Filtering, new { Controller = "ViewDate", Action = "AdvancedCustomBindingFilteringAction", key = "-1" });

Any idea how to resolve this?

Added By: Vladimir (DevExpress Support) at: 11/11/2014 10:25:08 PM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T171947: The ProcessColumnAutoFilter does not trigger. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Added By: Don Krasnick at: 1/21/2016 10:20:56 AM    

I've implemented this technique in our solution and it seems to basically work. The user's current selections are displayed in the EndCallback function via "dde.SetText". However, when the user manually clears out those values I would like the custom filtering to be removed, which is the same behavior for a "normal" field. I'd also like to allow the user to type a date range in their manually ("03/01/2015|04/01/2015") and have the same affect as though those dates were selected via the calendar popup.

How can I get that to happen? I haven't been able to figure out what event(s) should be captured. Having the user manually enter dates isn't critical, but we'd definitely like to be able to have those cleared values reset the filtering for the column.

Note that we haven't yet upgraded to v2015, so we're looking for a v2014 solution, if possible.

Added By: Artem (DevExpress Support) at: 1/22/2016 4:31:27 AM    

Hello Don,

To process your recent post more efficiently, I created a separate ticket on your behalf: T337328: Improve date range filtering example. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

OBSOLETE - How to export the colored ASPxGridView

$
0
0

UPDATED:

Starting with version v2015 vol 2 (v15.2), this functionality is available out of the box. Use ASPxGridView.FormatCondition rules to define conditional formatting in Browse Mode and keep the applied appearance in the Exported Document. Please refer to the ASP.NET Grid View - Data Range Filter, Adaptivity and More (Coming soon in v15.2) blog post and the Export with Format Conditions demo for more information.
If you have version v15.2+ available, consider using the built-in functionality instead of the approach detailed below.

For Older Versions:

This example demonstrated how to handle the ASPxGridViewExporter.RenderBrick Event to paint the exported ASPxGridView.

Question Comments

Added By: Smitha at: 5/30/2014 9:37:00 AM    

But how do I make the font to bold and also underline the text. If I do , it doesn't work. I get the error that the property is a read only one.
e.BrickStyle.Font.Bold = true;
e.BrickStyle.Font.Underline = true;

Added By: Larry (DevExpress Support) at: 6/2/2014 3:06:45 AM    

Hello,

I have created a separate ticket on your behalf to process your inquiry more effectively:
How to change font's Bold and Underline properties when export the colored ASPxGridView
Please refer to it for further correspondence. 

Added By: Nirav Vyas at: 1/21/2015 11:25:20 AM    

Hi , how can I set background color for detail grid while exporting? I am exporting master detail grid using PrintingSystem I am able to set background color in master as well as detail grid but not reflected when exported.

ref: https://www.devexpress.com/Support/Center/Question/Details/T184373

Please let me know if you need any further information.

Thanks
Nirav

Added By: Larry (DevExpress Support) at: 1/21/2015 10:15:16 PM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T199648: How to export the colored master-detail ASPxGridView using PrintingSystem. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

OBSOLETE - ASPxGridView - How to customize RowFilter in DataDateColumn and provide two ASPxDateEdit controls that allow setting a date range as a filter expression

$
0
0

UPDATED:

Starting with version v2015 vol 2 (v15.2), this functionality is available out of the box. Simply set the GridViewDataColumn.SettingsHeaderFilter.Mode property to DateRangePicker to activate it. Please refer to the ASP.NET Grid View - Data Range Filter, Adaptivity and More (Coming soon in v15.2) blog post and the Date Range Header Filter demo for more information.
If you have version v15.2+ available, consider using the built-in functionality instead of the approach detailed below.


For Older Versions:

To achieve this goal, use GridViewColumn.FilterTemplate. Place two ASPxDateEdit controls and the "Apply" button inside the template. In the ASPxClientButton.Click event handler, create a filter expression and apply it to the grid via the ASPxClientGridView.ApplyFilter method. See the example for more details. 

Question Comments

Added By: Dhiogo Roberto at: 9/16/2014 7:50:32 AM    

I tried to use this example, but it is not working.

Added By: Luke (DevExpress) at: 9/17/2014 1:38:26 AM    Hello Dhiogo,

We've successfully fixed the issue with this example's online launch, now it works correctly. Please check it out.


Best Regards,
LukeAdded By: Dhiogo Roberto at: 9/17/2014 5:00:00 AM    

I did not notice any change. Still does not work. Only the "Example Runner" works on site.

Added By: Luke (DevExpress) at: 9/18/2014 1:21:58 AM    Hello Dhiogo,

It's pretty strange, since on my side it runs online and works perfectly (see the attached video). Would you please clarify what browser you are using and what error you faced? It would be also greatly appreciated if you provide me with your own screencast illustrating the problem (you can use the Jing tool for this purpose).


Best Regards,
Luke

How to create fully custom Role, User, Event, Resource classes for use with the Security (old) and Scheduler modules

$
0
0

This example demonstrates how to create fully custom classes for use in our Security Module (with the 'old' DevExpress.ExpressApp.Security.SecurityComplex component) and Schedule Module:
    - Activity is an analog of our standard Event class that is used to represent appointments in the Scheduler Control.
    - Employee is an analog of the standard User class, which also supports the IResource interface to use objects of this class as resources in our custom appointment above.
    - Group is an analog of our standard Role class
To enable these two custom security classes in your application set the RoleType and UserType properties for the SecurityComplex component within the Application Designer.

Additionally, the two popular filtering tasks are implemented: filtering appointments by the current logged employee and also filtering resources to show only those owned by the current logged employee.
This functionality is provided by the SchedulerActivityListViewControllerBase class and its descendants as follows:
   a. Administrator account (Sam, to log on, leave the Password field empty) sees all the resources and appointments in the root scheduler view.
   b. Non-Administrator account (John, to log on, leave the Password field empty) sees only his own resources and appointments in the root scheduler view.
   c. Both Administrator and Non-Administrator accounts see their own resources and appointments in the nested scheduler view.
You can use SchedulerActivityListViewControllerBase  and related controllers for study purposes, since they demonstrate the most common filtering scenarios in the scheduler view. If you do not need all this specific functionality, simply remove these controllers and create your own ones (perhaps based on the provided example code) that will do only your specific task. For example, the controllers from this example are not suitable in the nested scheduler view because you miss some part of the default Link/Unlink functionality since the scheduler view is always filtered to show only its own resources and appointments.That may not be desired because you may want to have the capability to link appointments from other resources, but they won't be shown due to the above. Plus, these demo controllers are unnecessary for appointments filtering in the nested scheduler view, because by default, in this view only appointments from the current resources are shown.

Important notes

1. Example implementations are NOT designed for the 'new' security system components and scenarios (e.g., middle-tier application server or SecuredObjectSpaceProvider). To use the SecurityStrategyComplex component, provide fully custom implementations of the user and role classes as per the eXpressApp Framework > Task-Based Help > How to: Implement a Custom Security System User Based on an Existing Business Class article.

2. The Activity (appointment) and Employee (resource) classes' code was once created based on the code of the default Event and Resource classes from our DevExpress.Persistent.BaseImpl library. It is necessary to update their code based on the source ...\XAF\DevExpress.Persistent\DevExpress.Persistent.BaseImpl\ library sources according to changes made in the latest XAF versions.

Question Comments

Added By: Ad de Rijke at: 5/19/2014 4:52:28 AM    

The Web project does not compile: 'The type or namespace name 'WinWebSolutionAspNetApplication' could not be found (are you missing a using directive or an assembly reference?)'

Added By: Dennis (DevExpress Support) at: 5/20/2014 3:31:16 AM    @Ad: For some reason the WebApplication.cs file was emptied. I have attached a working sample for your reference. I will also update this example as well.Added By: Ville Virtanen at: 12/4/2015 11:06:39 PM    

When trying to run it gives an error: Another rule with ID = 'EventIntervalValid' already exists.

When I commented following lines, it worked, but how I disable the BaseImpl rule?

//[NonPersistent]
       //[Browsable(false)]
       //[RuleFromBoolProperty("EventIntervalValid", DefaultContexts.Save, "The start date must be less than the end date", SkipNullOrEmptyValues = false, UsedProperties = "StartOn, EndOn")]
       //public bool IsIntervalValid { get { return StartOn <= EndOn; } }

Added By: Dennis (DevExpress Support) at: 12/7/2015 5:41:37 AM    

@Ville: You can simply rename this rule without commenting it out to avoid this error. Or, you would better not to use the default Event class from the DevExpress.Persistent.BaseImpl library in your project.

Added By: Nate Laff at: 2/17/2016 7:43:43 AM    Can we see an update to this for 15.2? Things are currently pretty broken. In Activity.UpdateEmployees() the XML is coming back much different than it previously did.Added By: Dennis (DevExpress Support) at: 2/17/2016 8:09:23 AM    

@Nate: We will unlikely update this code for v15.2 for the reasons described in point #2 of the important notes to this example. The example's Activity class code is pretty much the same as the code of the Event class (similarly, Employee is an analog of the Event's Resource and security User classes) and we would like to avoid synchronization and maintenance problems for our users going forward.

In the future, I will probably rework this article to be more like a codeless KB article that would focus not on specific implementations, which are different for each concrete business scenario, but rather on the main points of such an integration, which are the same for all cases. I hope this makes sense.

How to: Filter a Report Parameter's Lookup

How to: Use Custom Logon Parameters

$
0
0

This example is now obsolete. The functionality demonstrated here is a part of the Security Demo located here: C:\Users\Public\Documents\DevExpress Demos 14.2\Components\eXpressApp Framework\SecurityDemo\CS. The complete description is still available in the How to: Use Custom Logon Parameters topic.

Question Comments

Added By: Alex Kads at: 3/18/2014 5:08:21 PM    

How to create many employees for many companies?

Added By: Konstantin B (DevExpress) at: 3/18/2014 9:46:36 PM    

As far as I can see, this example already demonstrates multiple companies and employees which can be used to logon. These objects are created in the Updater.cs file. If my comment isn't helpful, please submit a new support ticket and describe your scenario in grater detail.

Added By: Terence Pillay at: 2/18/2016 12:37:09 AM    Hi i am trying to implement this but, it keeps giving me null exception on 
the object space i have implemented everything  in this tutorial 
Please help


 [Browsable(false)]        [CollectionOperationSet(AllowAdd = false)]        public XPCollection<Company> AvailableCompanies        {            get            {                if (availableCompanies == null)                {                    availableCompanies = ObjectSpace.GetObjects<Company>() as XPCollection<Company>;                }                return availableCompanies;            }        }

How to create a drill-down report

$
0
0

This example demonstrates how to create a drill-down report. In this example, a master-detail report is created, in which the detail section for each category can be expanded or collapsed within the same preview window by clicking the appropriate link.


How to create drill-down documents with DXPrinting for WPF

$
0
0

This example demonstrates how you can provide interactivity for documents that are displayed in a Document Preview for WPF.

In particular, it shows how you can implement a drill-down document, in which detail data is hidden until a user clicks a link in the Document Preview, after which the corresponding part of data is shown in the same document.

How to implement the drill-down feature for XtraReports in a web application

$
0
0

This example illustrates how to implement the drill-down feature for XtraReports in a web application. This feature allows end-users to be able to collapse/expand some of the detail report bands in master-detail reports.

How to bind grid columns to complex object properties

$
0
0

This example demonstrates how to display and edit properties of complex objects (Dictionary values, DynamicObject descendants) in DXGrid. The GridBindingHelper helper class is used to bind grid columns to complex properties of this kind. Here are instructions on how to use it:

1) Use the GridBindingHelper.ItemsSource attached property to assign a datasource instead of the built-in DataSource property;
2) Use the GridBindingHelper.ComplexFieldName attached property to specify the field name;
3) Set the column's UnboundType property value.

We also do have plans to introduce built-in support for this functionality. Please track this suggestion to stay informed on our progress over this item:

S136096: Binding - Support binding to complex object properties

Question Comments

Added By: (no info) at: 7/23/2012 10:26:29 AM    

Thanks for the example, it works great, except that it has one minor bug - in GridColumnBindingHelper.cs ComplexPath constructor has this lines of code:
if(!string.IsNullOrEmpty(index) && Char.IsDigit(index[0])) {
                        pathPart = new PathPartList(path, int.Parse(index));
which will throw exeception if index variable contains something like this "322_PMI" as first character is digit, but whole string cannot be (obviously) parsed to int.

In order to make it work for our needs (as I've had complex paths like this "Items[322_PMI].Quantity") I've changed code to this (not fully tested though):
public ComplextPath(string complexPath)
               {
                    string[] paths = complexPath.Split('.');
                    for (int i = 0; i < paths.Length; i++)
                    {
                         string path = paths[i];
                         int braceIndex = path.IndexOf("[");
                         string index = null;
                         if (braceIndex >= 0)
                         {
                              index = path.Substring(braceIndex + 1, path.Length - braceIndex - 2);
                              path = path.Substring(0, braceIndex);
                         }

                         if (string.IsNullOrEmpty(index))
                         {
                              pathParts.Add(new PathPartSimple(path));
                         }
                         else
                         {
                              int parsedIndexAsInt32;
                              bool indexIsInt = int.TryParse(index, out parsedIndexAsInt32);
                              if (indexIsInt)
                              {
                                   pathParts.Add(new PathPartList(path, parsedIndexAsInt32));
                              }
                              else
                              {
                                   pathParts.Add(new PathPartDictionary(path, index));
                              }
                         }
                    }
               }

Added By: Ganesh Sharma 1 at: 1/7/2014 1:29:50 PM    

Does this work with ICollectionView?
If I create ICollectionView using CollectionViewSource.GetDefaultView(Rows) and bind it, it doesn't get the updates.
ICollectionView provides lot of options for sorting & filtering. Working with ICollectionView will be really good.

Added By: Stéphane CHÂTEAU at: 2/18/2016 5:29:20 AM    When using this solution it's work if no edition, else IDataErrorInfo is not call all the time...

ASPxTreeList - How to get node information and a click type (Click, DblClick, Click + pressed button) on a node click

$
0
0

This sample illustrates how to implement 3 different types of the node click events:
1) A simple click;
2) A double click;
3) A simple click + the pressed ALT

How to preserve the expanded state of TreeList nodes when refreshing data

$
0
0

The example contains a helper class that can be used to save and load the current expanded / collapsed state of the XtraTreeList nodes. Please refer to How to preserve the expanded state of TreeList nodes when refreshing data article to learn more.

Question Comments

Added By: Peppomuck at: 7/14/2013 8:09:46 AM    

Why don't you save the node.Id's in a List<int> ?
That would be more type safe (instead of seraching by node.GetValue(node.TreeList.KeyFieldName) and safing object types in ArrayList)
Besides, your example doesn't match when you reassign (e.g. after saving and reloading data) the binding source or the KeyFieldName doesn't expect like in the example.

Added By: Trent Jones at: 2/25/2015 11:17:09 PM    

Is there a chance of this being implemented to the XtraTreeList Suite? I can imagine there are large amounts of people who use this code regularly.

Added By: Olejka (DevExpress Support) at: 2/26/2015 4:29:09 AM    

Hello,

Currently, we don't have plans to implement this option out of the box. We've implemented this solution to allow our users to manually save nodes' state. 
Nevertheless, thank you for your input. We will consider implementation of this feature in the future.

Added By: alvin johnson 1 at: 2/18/2016 11:44:05 AM    Hello Olejka,

I have used this class to save the state of treelist. On save button click I have initialized XView and TreeStateView(TreeList) classes. And after that I am calling the method SaveState(). But it never shows any expanded and selected nodes.

Am I doing something wrong?

After this I want to serialize these expanded and selected properties to load this treelist state.

Please give me the solution.
Added By: Nadezhda (DevExpress Support) at: 2/18/2016 2:35:43 PM    

Hello alvin,

To process your recent post more efficiently, I created a separate ticket on your behalf: How to save state after update. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Viewing all 7205 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>