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

dxDataGrid - How to implement a custom store with CRUD operations (SQLite)

$
0
0

The dxDataGrid binding using a CustomStore help topic and the A custom data source does not apply paging, filtering, sorting and grouping article describe how to implement a custom data source that loads data for a dxDataGrid . 

This example demonstrates how to make a custom store that works with a SQLite data source. For this purpose, the SQLite PhoneGap plugin is used. Note how the custom store's insertupdate and remove methods are implemented to use the plugin's API. Each of these methods will be called automatically by the widget.  When a method is called, we need to execute a corresponding SQL query and pass the required parameters. Note that in order to work with the database, it is necessary to initialize it in the "deviceready" event handler:

[JScript]
//index.js $(document).on("deviceready", function(){... window.db = window.sqlitePlugin.openDatabase({ name: "DB"});});

Note how the deferred object resolves the amount of affected rows in each method and the reject function receives the exception message. This allows displaying the query execution exception in the grid's error row.

The example contains a ready-to-use package file for Android, so you can install and test it right away. Any modification or building the package for iOS will require going through steps described in Packaging.

See also:
Deferred Object
How to implement CRUD operations with a DataSource
dxDataGrid - How to implement a custom store with CRUD operations

Question Comments

Added By: Vivek Kanakia at: 7/3/2015 7:21:12 AM    

Hi,

I want to create mobile and web app using devExtreme
I want to give user offline capability.
Does devExtreme support CRUD operations out-of-the-box for offline storage.

Do you have sample code which demonstrates how to make a custom store like SQLite data source. Or any other data source.

I am interested in knowing insert, update and remove methods implemention. Each of these methods needs to be called automatically by the widget.  

Thanks & Regards,
Deepak Chavan, PMP

Added By: Anthony (DevExpress Support) at: 7/3/2015 12:36:38 PM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T263266: Inquires regarding the offline storage . This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.


How to import Google Calendar using Google Calendar API

$
0
0

This example demonstrates how you can use the Google Calendar API in your scheduling application.
The Google Calendar API enables you to establish seamless information exchange between your application and Google calendar(s) available online.
This project refers to, but does not include Google Data API assemblies. You are encouraged to download .NET library from the Google Data API Homepage and update project references.
The use of Google API is licensed under the Apache License, Version 2.0 (the "License"). You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
 
Appointment entries obtained via Google API are objects of Google.GData.Calendar.EventEntry type. Each appointment entry is processed to create an XtraScheduler appointment, recurrence pattern or exception. To parse recurrence information contained within appointment entry, a RecurrencePatternParserclass is implemented. It creates the DevExpress.XtraScheduler.iCalendar.iCalendarEntryParserinstance to parse recurrence information represented by a string in iCalendar format. The DevExpress.XtraScheduler.iCalendar.iCalendarEntryParser instance holds the parse results and provides access to property values by property names.
Note that a special method is required to link exceptions (changed or deleted occurrences) with their patterns since they are created independently while processing Google appointment entries.

Question Comments

Added By: Marco Calabri at: 7/10/2013 1:28:41 AM    

good morning to all,
thanks for the example
how can I import the "Description" field from Google Calendar?
thanks for your help

Added By: subbu .B at: 10/10/2013 10:48:16 PM    

Hi,
I need help.How can i implement same code in my windows phone app using c#.
Thnaks,

Added By: Stephen Wright at: 7/4/2015 1:01:28 PM    

Thanks for the example. I have downloaded the latest DLL's from the website. The code fails on line 111

UserProfile.Instance.Calendars = (CalendarFeed)service.Query(query);

the catch then says it is an invalid username/password. But I know these to be correct because I use them to login via chrome.
Can someone suggest what I've left out.

Regards.

How to pass a dashboard parameter to a custom SQL query

$
0
0

The following example demonstrates how to create a new dashboard parameter and pass it to a custom SQL query.

In this example, the dashboard parameter is passed to the custom SQL query parameter's expression. This allows you to dynamically change the query passed to the server.

Question Comments

Added By: Markus Kvist at: 7/5/2015 3:30:19 AM    

A much simpler way is to use the Query Builder directly, which also allows expressions exactly as was done in code below, unless you need the dynamic SQL: https://documentation.devexpress.com/#Dashboard/CustomDocument113947

How to export MVCxPivotGrid and the bound ChartControl to the same print document

$
0
0

This example illustrates how to export MVCxPivotGrid and the bound ChartControl to the same print document. 

Grid for Xamarin - Columns

$
0
0
This example demonstrates how to add columns to GridControl to display and edit data of different types. Grid columns are stored in the GridControl.Columns collection. An individual column is specified by a GridColumn class descendant, which is appropriate to the type of data contained in this column. The following column types are available in the grid:
- ImageColumn
- TemplateColumn
- NumberColumn
- TextColumn
- DateColumn
- PickerColumn
- SwitchColumn
The complete description is available in the How to: Create Grid Columns for Data of Different Types topic.

How to implement the Load More functionality

$
0
0
This example shows how to implement the grid's load-more feature - when an end-user scrolls to the bottom of the grid, a set of new data items is added to the end of the grid. To add this functionality, follow the steps below.

    1. Set the GridControl.IsLoadMoreEnabled property to true to enable the grid's load-more feature.
    2. Create a command to be executed when an end-user scrolls to the bottom of the grid.
    3. Bind the created command to the grid using the GridControl.LoadMoreCommand property. 

In this example, data items for each next load (ten new orders) are generated randomly in code. The maximum number of loads an end-user is allowed to perform is 10. The count of data items currently loaded to the grid is displayed by the total summary that is automatically updated after each load.

How to add the pull-to-refresh functionality

$
0
0

This example shows how to add the pull-to-refresh functionality to a grid to allow your end-users update grid content with the pull-down gesture. To do this, follow the steps below.

    1. Set the GridControl.IsPullToRefreshEnabled property to true to enable the grid's pull-to-refresh feature.
    2. Create a command to be executed when an end-user pulls the grid down.
    3. Bind the created command to the grid using the GridControl.PullToRefreshCommand property.

ASPxGridView - How to calculate and set column values in the Edit Form on the client side and server side

$
0
0

This example implements the approach demonstrated in the KA18839: ASPxGridView - How to set column values in the Edit Form depending on another editor's valueKB article.

See Also:
E3929: ASPxGridView - How to calculate column values on the client side via editors inside DataItemTemplate

Question Comments

Added By: Mauricio Rivera Fernández at: 1/24/2015 12:47:57 PM    

This solution works fine and perfect, but when i use PopupEditForm, the popup disappears and when return it, reappears. How Can I Avoid this flicker?

Added By: Luke (DevExpress Support) at: 1/25/2015 11:51:54 PM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: ASPxGridView.PopupEditForm disappears. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Added By: Carlos Alfredo Borjas at: 7/6/2015 12:49:03 PM    

Can I use the batch method in this example? and I've tried But I did not work , please give me more information about how I can edit the values ​​of other cells in a batch.


ASPxDropDownEdit - How to select Year and Month only

$
0
0

This example demonstrates how to create a DateEdit analog based on ASPxDropDownEdit with a custom DropDownWindowTemplate that allows you to select Year and Month only.

Question Comments

Added By: Julien Joubert at: 2/8/2013 6:57:14 AM    

Hello,
Could you please provide a similar code for razor please?
Indeed, when I look at the events available inside settings.Properties.ClientSideEvents for @Html.DevExpress().DropDownEdit mvc extension, I don't have PrevClick, NextClick or OkClick and the closest for OnClick is ButtonClick.

Added By: Sergio Rios at: 5/12/2014 8:20:26 AM    

Awesome, with this kind of thing devexpress shows it really cares for the suscribers. Thanks.

Added By: Dhiogo Roberto at: 12/2/2014 4:23:39 AM    

I was thinking of applying these changes during the callback, what should I do? (Since it is applied in the Init event)

Added By: Larry (DevExpress Support) at: 12/3/2014 2:55:16 AM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T182140: ASPxDropDownEdit - How to select Year and Month only (server-side processing). This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Added By: Dhiogo Roberto at: 7/6/2015 1:10:20 PM    

It's not my case. The components are within the callbackpanel.

But how do this work since the init occurs before the callback?

Added By: Dhiogo Roberto at: 7/6/2015 1:13:10 PM    

I think there could be a native way to do this.

Added By: Helen (DevExpress Support) at: 7/6/2015 1:41:46 PM    

Hi Dhiogo,

I moved your comments to the T182140: ASPxDropDownEdit - How to select Year and Month only (server-side processing) thread and re-activated it. I suggest that you continue the discussion about your scenario in that ticket.

How to use a ComboBoxEdit whose choices are different for each cell in the grid

$
0
0

There are two ways to accomplish this task: via filter criteria and by using a multibinding approach. Let me explain theses approaches in detail.


1) Filter criteria

The main idea is to dynamically construct a filter by using the selected value of the first column in the grid. So, items in the ComboBox editor will be filtered automatically according to the filter's value. In this case, it is necessary to create a converter (which implements the IValueConverter interface) in the code-behind file.


2) Multibinding approach.
You can also resolve this problem by using the multibinding approach. Specify multiple bindings in a MultiBinding object and create a converter (which implements the IMultiValueConverter interface) to produce a final value for the binding target property based on values of those bindings.

Question Comments

Added By: XempleX at: 4/5/2013 1:10:41 AM    

The problem with this solution is that the ItemsSource is used by all the rows in the grid. This means that, if you've already selected a colour for "Make1", then while you're selecting a colour for "Make2", the colours in the "Make1" rows disappear! In fact, in the example below, they never reappear because the HiddenEditor event hasn't been handled. So this solution is only useful when you only have a single "Make" in the grid (which means that it isn't really useful at all).

Added By: Elliot (DevExpress Support) at: 4/16/2014 12:54:00 AM    

Please accept my sincere apologies for the delayed response. I re-created this code example in November, 2013. Currently, this code example works correctly for this situation. You can download the new version of this code example from our website and check it. If you experience any further difficulties, do not hesitate to contact us again. We are here to help you.

Added By: Johnson Ho at: 7/6/2015 3:04:21 PM    

Is there an updated working example/project of this available?  Thanks.

How to: Print a report without displaying a preview

$
0
0

This example demonstrates how to implement the InstantPrintReport Action that prints the current report without displaying its preview. The complete description is available in the How to: Print a Report Without Displaying a Preview (in Reports V2) topic.

You can also use the code from this example to access an XtraReport object and then export or email a report content according to tutorials listed in the Export a Report document.

 

Question Comments

Added By: Reinhold Erlacher at: 11/26/2014 1:30:16 AM    

Current sample prints all records regardless of selection.
What ist the best way to introduce a filter to print selected records only?

Thanks
Reinhold

Added By: Alexey (DevExpress Support) at: 11/26/2014 1:41:42 AM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T178843: E5146: How to print only selected records. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

ASPxGridView - How to change a default editor to ASPxGridLookup in FilterRow via FilterTemplate

$
0
0

In some cases, when the default filter row editor's functionality is not enough, you can provide custom filter cell content using the FilterTemplate.

In this example, a default cell editor is replaced with the ASPxGridLookup control. The control's ValueChanged client-side event is used to send a callback to the server side, invoking the grid's CustomCallback event. In the event handler, a filter criteria is created and applied to the grid using the ApplyFilterToColumn method.

Question Comments

Added By: jasanguineti at: 1/13/2014 7:12:39 AM    

Please how set it filtertemplate in runtime?

thanks very much.

Added By: Ruslan (DevExpress) at: 1/13/2014 8:26:17 AM    

It's quite simple.
You need create a class that implements the ITemplate interface and assign template object to the GridViewDataColumn.FilterTemplate property.

protected void Grid_Init(object sender, EventArgs e) {
    var grid = (ASPxGridView)sender;
    grid.DataColumns["CategoryName"].FilterTemplate = new CustomFilterTemplate();
}
...
public class CustomFilterTemplate : ITemplate {
    public void InstantiateIn(Control container) {
        var lookup = new ASPxGridLookup();
        lookup.ID = "Lookup";
        container.Controls.Add(lookup);
    }
}

How to handle a specific event within a whole document object and handle keyboard pressing

$
0
0

This example illustrates how to:
- Handle a specific event (for example, "keydown") within a whole document object;
- Perform a specific action when a specific keyboard key (for example, ESC) is pressed.

The client-side ASPxClientUtils.AttachEventToElement method allows for attaching a handler to the "keydown" event over the "document" object.

ASPxButton.aspx:
Clicking the "Escape" key calls the client-side ASPxClientButton.DoClick method and invokes the custom alert message to inform an end-user of the clicked key.

OBSOLETE:

Starting with version v2014 vol 2 (v14.2), this functionality is available out of the box. Simply set the ASPxPopupControl.CloseOnEscape property to true to activate it. Please refer to the Popup Control - Main Features demo to see this feature in action.

ASPxPopupControl.aspx:
Clicking the "Escape" key hides ASPxPopupControl via the client-side ASPxClientPopupControl.Hide method.

(Obsolete) dxPopup - How to create a custom alert message

$
0
0

Starting with 14.1 follow the recommendations from the How to use the same dxPopup or another widget on different views article or use DevExpress.ui.dialog.custom.

This task can be implemented using the dxPopup control.


If you need to show a message, perform the following steps:

1. Create a new DIV and add it to the viewPort DIV;

2. Create the dxPopup widget in the created container and specify settings for this widget;

3. Show a popup.


If you need to hide a popup, perform the following steps:

1. Find instance of our popup using jQuery;

2. Hide a popup;

3. Remove DIV (popup container) from the viewPort DIV.


This example demonstrates this approach in action.

See also:
dialog

Question Comments

Added By: David Coronel at: 1/17/2013 5:20:44 AM    

There is an error when I try to download the example, please help

How to implement filtering of TreeListControl that shows filtered items and all their parent items

$
0
0

This sample shows how to implement filtering of TreeListControl that shows filtered items and all their parent items.

In 15.1, we introduced the extended filter mode providing this functionality out of the box.

Question Comments

Added By: perspectiv_developer at: 10/2/2014 1:00:22 AM    

Does this solution should show filtered items and parent of that items? Or shows all parents and filtered leaves?

Added By: Alexander Ch (DevExpress Support) at: 10/2/2014 3:50:27 AM    In this example, Tree List shows only those items whose children meet the applied filter criteria.

Thanks,
Alex

BarManager - How to automatically show and hide Bar when hovering the edge of Form

$
0
0
This example illustrates how to automatically show and hide Bar when Mouse cursor is in the Form's edge

How to apply a Bootstrap Form (form-control, btn, etc.) style to the DevExpress editors in Native mode

$
0
0
This example illustrates how to enable the Native rendering mode (by setting the Native property to True) in order to produce the raw HTML elements and apply the Bootstrap Form (form-control, btn, etc.) style.
There is also a side-by-side comparison with the same set if editors in the DevExprss Moderno theme (applied in the Web.config) that has a similar color schema as the Bootstrap.

The main requirement is to set the editor's Native property in order to produce the raw HTML rendering and apply the Bootstrap style via the CssClass property:

[ASPx]
<dx:ASPxTextBox...Native="true"CssClass="form-control"></dx:ASPxTextBox><dx:ASPxMemo...Native="true"CssClass="form-control"></dx:ASPxMemo><dx:ASPxButton...Native="true"CssClass="btn btn-primary"></dx:ASPxButton>

Optionally, it may be necessary to specify the editor's Width and Height dimensions (in percent or pixels) in order to achieve a consistent/custom layout.

MVC Version:
How to apply a Bootstrap Form (form-control, btn, etc.) style to the DevExpress editors in Native mode

How to apply a Bootstrap Form (form-control, btn, etc.) style to the DevExpress editors in Native mode

$
0
0
This example illustrates how to enable the Native rendering mode (by setting the Native property to True) in order to produce the raw HTML elements and apply the Bootstrap Form (form-control, btn, etc.) style.
There is also a side-by-side comparison with the same set if editors in the DevExprss Moderno theme (applied in the Web.config) that has a similar color schema as the Bootstrap.

The main requirement is to set the editor's Native property in order to produce the raw HTML rendering and apply the Bootstrap style via the CssClass property:

[C#]
@Html.DevExpress().TextBox(settings=>{...settings.ControlStyle.CssClass="form-control";settings.Properties.Native=true;}).GetHtml()@Html.DevExpress().Memo(settings=>{...settings.ControlStyle.CssClass="form-control";settings.Properties.Native=true;}).GetHtml()@Html.DevExpress().Button(settings=>{...settings.ControlStyle.CssClass="btn btn-primary";settings.Styles.Native=true;}).GetHtml()

Optionally, it may be necessary to specify the editor's Width and Height dimensions (in percent or pixels) in order to achieve a consistent/custom layout.

WebForms Version:
How to apply a Bootstrap Form (form-control, btn, etc.) style to the DevExpress editors in Native mode

How to sort the pivot grid's data by OLAP member properties

$
0
0
This example demonstrates how to sort data by OLAP member properties using the CustomServerModeSort event. In this example, the "Product" field's values are sorted by the "Color" OLAP member property.

ASPxGridView - How to implement Batch Editing using Entity Framework

Viewing all 7205 articles
Browse latest View live


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