Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export #21

Closed
demonicmetalcs opened this issue Nov 5, 2015 · 7 comments
Closed

Export #21

demonicmetalcs opened this issue Nov 5, 2015 · 7 comments

Comments

@demonicmetalcs
Copy link

I am looking for the export to pdf / excel function is this not implemented or am i doing something wrong.

@Terricks
Copy link
Owner

Terricks commented Nov 6, 2015

It s not implemented

@demonicmetalcs
Copy link
Author

Any tip on how to implement this?
I would like this feature and would not mind to implement it myself and share it with you.
But i don't know where to start

@Terricks
Copy link
Owner

Terricks commented Nov 6, 2015

There are several ways:

  1. If standard export actions are based on model settings and collectionSource data in list editor (you will know it by discovering DX sources) - you can adapt it to XafB (maybe there are not implemented some interface functions or something like this - it's hard to say now why it s not displayed). But i think it's based on editor's export functionality (like ASPxGridView and it's Win analogue) - so, we couldn't use it, because it's only call control export functionality and returns result (but I'm not entirely sure about this, it need to be discovered)

  2. Add your own ExportActions in controller, show it to user only if editor is assignable from XafBootstrapTableEditor, generate xlsx/pdf files on action's choice execute and return generated result to user by Response (action must be synchronous to return data correctly, to do this check IsPostBackRequired in action model and use ResponseWriter.WriteFileToResponse(stream, nomefile)). In this way you can implement all logic in one controller.
    Here is some links, that can help you:
    https://www.devexpress.com/Support/Center/Question/Details/Q424812
    https://www.devexpress.com/Support/Center/Question/Details/T126725
    https://www.devexpress.com/Support/Center/Question/Details/Q583683

@Terricks
Copy link
Owner

Terricks commented Nov 6, 2015

The main work will be to write export logic, that generates files from collection source data. You can try to use existing DevEx functions/controls/libs (for example based on ASPxGridView or other controls).

@demonicmetalcs
Copy link
Author

I have added the export function by adding the IExportable interface to XafBootstrapTableEditor

and the following code

public void OnExporting()
{
var printableEditor = new ASPxGridListEditor(ListView);
printableEditor.CreateControls();
printableEditor.Setup(collection,App);
printableEditor.Grid.Visible = false;
aspxGridViewExporter.Page = control.Page;
control.Controls.Add(printableEditor.Grid);
}
private ASPxGridViewExporter aspxGridViewExporter;
public List SupportedExportFormats { get {
if(Printable == null) {
return new List();
}
else {
return new List() {
ExportTarget.Csv,
ExportTarget.Html,
ExportTarget.Image,
ExportTarget.Mht,
ExportTarget.Pdf,
ExportTarget.Rtf,
ExportTarget.Text,
ExportTarget.Xls,
ExportTarget.Xlsx
};
}
}}

    public IPrintable Printable
    {
        get { aspxGridViewExporter = new ASPxGridViewExporter(); return aspxGridViewExporter; }
    }

    public event EventHandler<PrintableChangedEventArgs> PrintableChanged;

@Terricks
Copy link
Owner

Terricks commented Nov 7, 2015

Thank you for your work and code, we'll research and add it to addon.

Terricks pushed a commit that referenced this issue Jul 27, 2016
Fixed issues: #9, #10 (implemented focus logic), #18, #19, #15, #21

New features:
- New kind of menu
- Support for awesome-icons set
- Improve stability and functionality
- Support for DevExpress 15.2 lib.

Known issues:
- With new style DevExpress included jQuery by default. So, in
XAFBootstrap it has been disabled. But if you use old templates - you
need to include it (put off commented rows in XAFBootstrap with jQuery).
Or you can enable html5 support in web.config of your web project -
devExpress/settings section (it has to be doctypeMode="Html5")
@Terricks
Copy link
Owner

Enhanced in release 15.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants