Ticket T474351
Visible to All Users

In-place report - How to print all records if user did not select one

created 8 years ago

[DevExpress Support Team: CLONED FROM T454910: ASPxGridListEditor loads the entire data set in Server Mode when ShowSelectionColumn is set to True]
Hello,
I have a question regarding the removed SelectAll.Checkbox in Web, when ServerMode.
What is the best way to use ServerMode with in place reports?

I have a grid with about 800 rows in servermode and now I would like to print an in place report selecting all rows.
How should I do this?

Thanks for your help
Regards
Reinhold

Answers approved by DevExpress Support

created 8 years ago (modified 6 years ago)

There are two solutions:

I suggest you implement a custom Action that would silently print all or just chosen records using the approach described in the Task-Based Help > How to: Print a Report Without Displaying a Preview  article. Take special note of the ReportsDataSourceHelper.SetupBeforePrint method allowing you to specify a custom filter for your report data source.

The code snippet below demonstrates how to implement an extended PrintSelectionBaseController that prints all records if the user did not select one. Note that by default, the ShowInReportV2 action has the SelectionDependencyType option set to RequireMultipleObjects. Change this option to Independent in the Model Editor, so that this action will be available even if no records are selected in the ListView.

C#
using DevExpress.Data.Filtering; using DevExpress.ExpressApp; using DevExpress.ExpressApp.Actions; using DevExpress.ExpressApp.ReportsV2; public abstract class CustomPrintSelectionBaseController : PrintSelectionBaseController { protected override void ShowInReport(SingleChoiceActionExecuteEventArgs e, string reportContainerHandle) { if(e.SelectedObjects.Count == 0) { ReportDataInfo info = (ReportDataInfo)e.SelectedChoiceActionItem.Data; ShowAllInReport(info.ReportContainerHandle); } else base.ShowInReport(e, reportContainerHandle); } public void ShowAllInReport(string reportContainerHandle) { var reportServiceController = Frame.GetController<ReportServiceController>(); reportServiceController.ShowPreview(reportContainerHandle, GetCollectionSourceFilter() & GetGridFilter()); } protected abstract CriteriaOperator GetGridFilter(); private CriteriaOperator GetCollectionSourceFilter() { var listView = (ListView)View; var collectionSource = listView.CollectionSource as CollectionSource; return collectionSource.GetTotalCriteria(); } }
C#
using DxSample.Module.Controllers; using DevExpress.Data.Filtering; using DevExpress.ExpressApp; using DevExpress.ExpressApp.Web.Editors.ASPx; namespace DxSample.Module.Web.Controllers { public class CustomPrintSelectionControllerWeb :CustomPrintSelectionBaseController { protected override CriteriaOperator GetGridFilter() { var listView = (ListView)View; var editor = (ASPxGridListEditor)listView.Editor; return ObjectSpace.ParseCriteria(editor.Grid.FilterExpression); } } }
XML
<Action Id="ShowInReportV2" SelectionDependencyType="Independent" />

I also attached a sample project for your reference. For consistency, I have modified the subject heading of this ticket and updated our answer with this solution. Please let me know if you have additional questions. I will be happy to answer them.

    Show previous comments (9)
    RE RE
    Reinhold Erlacher 8 years ago

      Works great
      Thank you very much!

      JK JK
      Jacek Kosinski 7 years ago

        DevExpress Team
        Could you provide example of this functionality for Win.Modules ?
        thanks in advance

        DevExpress Support Team 7 years ago

          Hello Debeściak,

          Please await our answer in the ticket you created earlier: T660257.

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.