BoldSign®Effortlessly integrate e-signatures into your app with the BoldSign® API. Create a sandbox account!
Working on a spreadsheet display. The data that's being return is an IEnumerable
@Html.EJS().Spreadsheet("spreadsheet").Sheets((sheet) =>
{
sheet.Ranges((ranges) =>
{
ranges.DataSource(ViewBag.TransactionReport).Add();
}).Add();
sheet.Columns(new List()).Add(); //maybe similar?
}).Render()
Hi Andrew,
We suspect that you need to display the certain columns from the data source instead of showing all column values. And it can be achievable in our spreadsheet by using the query property. For more details regarding this requirement. Please refer the below links.
https://ej2.syncfusion.com/aspnetmvc/Spreadsheet/RemoteDataBinding#/bootstrap5
https://ej2.syncfusion.com/aspnetmvc/documentation/spreadsheet/data-binding#remote-data
Could you please check the above links and get back to us with more details like video demonstration? If we misunderstood your requirement or need any further assistance on this.
Regards,
Sangeetha M
Thank you. Using this I'm able to create just the desired columns but before I go much deeper, will this work using a Viewbag property as the data source?
@using Syncfusion.EJ2
@Html.EJS().Spreadsheet("spreadsheet").SaveUrl("Save").Sheets(sheet =>
{
sheet.Name("Report").Ranges(ranges =>
{
ranges.ShowFieldAsHeader(false).StartCell("A2").Query("new ej.data.Query().select(['COL1','COL2'])").DataSource(datamanager =>
{
datamanager.Data(ViewBag.Report);
}).Add();
}).Rows(row =>
{
row.Cells(cell=>
{
cell.Value("COL1").Add();
cell.Value("COL2").Add();
}).Add();
}).Columns(column =>
{
column.Width(25).Add();
column.Width(50).Add();
}).Add();
}).Render()
Hi Andrew,
Your requirement can be achievable in our spreadsheet by using query property for viewbag datasource as like as below.
@Html.EJS().Spreadsheet("spreadsheet").Sheets(sheet => { sheet.Name("Shipment Details").Ranges(ranges => { ranges.ShowFieldAsHeader(false).StartCell("A2").Query("new ej.data.Query().select(['CustomerName', 'Model', 'PaymentMode', 'Amount']).take(200)").DataSource((IEnumerable<object>)ViewBag.DefaultData).Add(); }).Rows(row => { row.Cells(cell => { cell.Value("Customer Name").Add(); cell.Value("Model").Add(); cell.Value("Payment Mode").Add(); cell.Value("Amount").Add();
}).Add(); }).Columns(column => { column.Width(100).Add(); column.Width(130).Add(); column.Width(100).Add(); column.Width(220).Add(); column.Width(150).Add(); column.Width(180).Add(); }).Add(); }).Render() |
For your convenience we have prepared the sample based on our suggestion. Please find the link below.
Sample Link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/SpreadsheetMVC205041077
Could you please check the above link and get back to us, if you need any further assistance on this.
Regards,
Sangeetha M