|
function onLoad(args) {
var jsonObj = this.model.dataSource[0];
if (this.model.columns.length == 0 && jsonObj) {
for (var field in jsonObj) {
var value = jsonObj[field];
var format = null;
//from the object values type has been defined
//so you can dynamically assign them to the columns
type = value != null ? (value.getDay ? (value.getHours() > 0 || value.getMinutes() > 0 || value.getSeconds() > 0 || value.getMilliseconds() > 0 ? "datetime" : "date") : typeof (value)) : null;
. . .
if (type == "boolean")
editType = "booleanedit";
else if (type == "date") {
editType = "datepicker";
format = "{0:ddd.MM.yyyy}";
}
. . .
this.model.columns.push({
field: field,
width: 50,
type: type,
editType: editType,
headerText: field,
format:format,
textAlign: ej.TextAlign.Right
});
}
}
} |
|
function onLoad(args) {
var jsonObj = this.model.dataSource[0];
.. .
if (this.model.columns.length == 0 && jsonObj) {
for (var field in jsonObj) {
if (field === "OrderDate") {
this.model.columns.push({
field: field,
headerText: field,
type: "date",
filterType: "menu",
format: "{0:dd.MM.yyyy}"
});
continue;
}
. . .
//add summary row
. . .
}
} |
|
@Load event
function onLoad(args) {
var data = this.model.dataSource;
this.model.dataSource = ej.isJSON(data);//here we can parse the datasource as JSON
} |
|
public void ExportToPdf(string GridModel)
{
PdfExport exp = new PdfExport();
GridProperties obj = ConvertGridObject(GridModel);
PdfDocument document = new PdfDocument();
PdfGridLayoutFormat format = new PdfGridLayoutFormat();
document.PageSettings.Orientation = PdfPageOrientation.Landscape;//set the page orientation
document.PageSettings.Size = PdfPageSize.A3;// Set the page size
IEnumerable
UN
Unknown
November 10, 2017 11:04 PM UTC
Hello Thank you once again for your reply. 1 & 2: Thank you for the video, but I know how to use the filter. It works perfectly fine with grids that do not have dynamically added columns. I tried the conversion of the datasource but it did not change anything, as it is already valid. However, you were right about the date being just a string. In the datasource it was stored as e.g. "10.11.2017". In the "Load" event of the grid I loop through the whole datasource and create date objects from the strings and everything works fine now. These issues are resolved. Thank you a lot for your help. 3: It is not an option for me to change the pdf paper size to A3, it must be A4. Still, I tried it with A3, but nothing changed. Some other things I noticed:
Please find printscreens of the three pdfs in the attachment. I have also tried setting the "CommonWidth" property of the grid, but that did not change anything. In the export function I manually chagned the width of all the columns of the "GridProperties" object before I call the Export method of the PdfExport. This did not change the pdf in any way. Phil Attachment: screenshots_e8499b9b.zip
VA
Venkatesh Ayothi Raman
Syncfusion Team
November 13, 2017 10:37 AM UTC
Hi Phil,
Thanks for the update.
Query #1 & #2:”Date format issue and filter issue”
We have very happy to hear that your requirement is achieved.
Query #3:”PDF export Issue”
We went through your printscreen screenshots that you have shared for us and we are able to reproduced the reported issue at our end while rendered the columns without defining the column’s width and disabling the IsAutoFit property in Export method. Please refer to the following scenario for issue replication procedure,
Rendered the columns without defining the column’s width,
Also, disable the IsAutoFit property in Grid,
In above code example, Highlighted Boolean value is belonging to IsAutoFit property in Export method. So, we suggest you to enable the IsAutoFit property in Export method to resolve this issue as we told in previous update. Please refer to the following code example,
Note: In above code example,8th property is an IsAutoFit property in Grid Export method.
We have also prepared a sample for your requirement which can be download from following link,
If you still face the same issue, then could you please provide the following details,
1) Essential Studio version and browser details
2) Scenario to reproduced the reported issue.
3) A sample if possible or modified the given sample as issue reproducible.
Regards,
Venkatesh Ayothiraman.
UN
Unknown
November 13, 2017 03:52 PM UTC
Hello The IsAutoFit property was already set to true in my code. This setting causes the grid to not use all available width. When I set this property to false and the combined columns are too wide, the resulting table in the pdf prints first all columns that fit on one page, then after all the data of these columns are shown, the next columns are appended and so on. This helped me find a workaround for my problem. Now I set the IsAutoFit property to false and manually calculate the width for each column and set them (in the exportToPdf action on the server). The layout is not always perfect and it is definitely not a clean solution but for the time being it is good enough. Therefore issue 3 is resolved. Once again, thank you a lot for all the help you provided. Phil
VA
Venkatesh Ayothi Raman
Syncfusion Team
November 14, 2017 04:18 AM UTC
Hi Phil,
Thanks for the update.
We are very happy to hear that your requirement is achieved.
Regards,
Venkatesh Ayothiraman.
SIGN IN To post a reply.
12/29/2025 08:14:57 AM
Sun, 15 December 2024 03:30:00 UTC
Sun, 15 December 2024 03:30:00 AM
Wed, 16 Feb 2022 04:59:00 UTC
|