Hi
I want to Copy/Export only Data which is Visible on Screen.
1. Run the attached sample (in Test.zip).
2. Group by "Abbrviation" and expand few group by rows (as shown in ExportOnly.png in attached Test.zip).
3. When I hit a button, I want to copy/export (into excel or clipboard) the only data which is visible on screen i.e. Red color rectangle marked area data in ExportOnly.png. I DO NOT want to copy/export data which is not in visible on screen.
Can we do this?
Thanks in advance.
Anyone from Infragistics support?
Hello,
Thank you for your post. I have been looking into it and I created a sample project for you with the functionality you want. Basically I handled the DataPresenterExcelExporter’s RecordExporting event and checked if the Record is in view and if it is not I cancel the exporting. Please let me know if this helps you or you need further assistance on this matter.
Looking forward for your reply.
Thank you for the reponse.
I ran the code and result was not as expected. Check the attached image for the current result (with the code that you uploaded) and result that I am expecting (i.e. as visible on the screen).
Hello again,
I have modified the sample project I sent you before, so now it works as you want. Also I can say that since the DataPresenter buffers a few Records that are not in view the Exporting will export 2 or 3 Records that are not in the viewable area. If you don't want them to be exported you can modify the code, so it check how many records it should skip on different scenarios.
Since this method gets the elements in view, without expanding a grouped Record you won't be able to get the Cells in view.
Thanks.
Can't we do that without expanding?. Might not want to expand any group by row and want to get visible columns(fields).
You can try to expand the first Record, so the Cells can be rendered and the GetCellsInView return the cells in view and then collapse the Record.
Hope this helps you.
Any updates?
Thank you for the quick response.
GetCellsInView() (Ex: MyLocalGrid.GetCellsInView().Where(t => t.Fields.Exists(e => e==record.FieldLayout.Fields[inti])).Count()) works fine if no group by.
If I have group by and group by rows are not expanded, GetCellsInView() return with Count=0.
1. How can we get the fields when group by exist (as in above case)?
2. If I expand the group by, GetCellsInView() returns list. Issue with this is, if i have group by column fixed and scroll horizontal to right, it still return all field (even some of non group by fields not visible on screen). In this case any other way we can get in view fields ?