how can get the spreadsheet from workbook if the workbook is created from to json?
public ActionResult MyAction(string data, string extension)
{
Workbook workbook = Workbook.FromJson(data);
// I need do something here with the spreadsheet
}
}
Hello,
it seems the hierarchy-function only works the first time. If i click on the symbol for another node the controller action fires, data comes back, but for whatever reason the grid doesn't show the data in the grid.
I'm not quite sure why this doesn't work, but to me it seems like tha grid doesn't refresh itself.
View:
@using DAKCrmImport.Web.Models;
@{
ViewBag.Title = "Index";
}
<h2>Profilübersicht</h2>
@(Html.Kendo().Grid<CrmProfileGridVM>().Name("grid-crmprofiles").BindTo(Model).Columns(c =>
{
//<a class='button-action grid-details' onclick='showProfile(this)' title='Details'>button details</a>
c.Template(t => { }).HeaderTemplate("")
.ClientTemplate(@"
<a class='button grid-button button-details' title='Details' id='bt-profile-details'>button details</a>
<a class='button grid-button button-delete' onclick='' title='Löschen' id='bt-profile-delete'>button delete</a>
<a class='button grid-button button-edit' onclick='' title='Bearbeiten' id='bt-profile-edit'>button edit</a>
<a class='button grid-button button-create' onclick='' title='Job erstellen' id='bt-profile-createjob'>button create</a>").Width(250);
c.Bound(i => i.Name);
c.Bound(i => i.JobCount);
c.Bound(i => i.UserGroup);
c.Bound(i => i.CreatedBy);
c.Bound(i => i.CreatedAt);
c.Bound(i => i.LastUpdatedBy);
c.Bound(i => i.LastUpdatedAt);
})
.ToolBar(toolBar => toolBar.Template("<a href='javascript: void(0)' class='button button-create2' title='Neues Profil anlegen' id='bt-profile-create'>button create</a>"))
.HtmlAttributes(new { style = "height: 680px;" })
.Editable(editable => editable.Mode(GridEditMode.PopUp))
.Scrollable()
.ClientDetailTemplateId("template-grid-crmprofile")
.Groupable()
.Sortable()
.Pageable(pageable => pageable
.Refresh(true)
.PageSizes(true)
.ButtonCount(5))
.Filterable()
.DataSource(dataSource => dataSource
.Ajax()
.ServerOperation(false)
.Model(model => model.Id(p => p.Id))
.Read(r => r.Action("Read", "CrmProfile"))
))
<script id="template-grid-crmprofile" type="text/kendo-tmpl">
@(Html.Kendo().Grid<CrmJobGridVM>()
.Name("grid-crmjobs")
.Columns(c =>
{
c.Bound(j => j.CreatedBy);
c.Bound(j => j.JobStatus);
c.Bound(j => j.CreatedAt);
c.Bound(j => j.EndedAt);
c.Bound(j => j.CrmObjectCount);
})
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(10)
.Read(r => r.Action("GetJobsByProfileId", "CrmJob", new { profileId = "#=Id#" }))
)
.ClientDetailTemplateId("template-grid-crmjob")
.Pageable()
.Sortable()
.ToClientTemplate()
)
</script>
<script id="template-grid-crmjob" type="text/kendo-tmpl">
@(Html.Kendo().Grid<CrmObjectGridVM>()
.Name("grid-crmobjects")
.Columns(c =>
{
c.Template(t => { }).HeaderTemplate("").ClientTemplate("<a class='button grid-button button-details bt-object-details' title='Details'>button details</a>")
.Width(50);
c.Bound(o => o.OrdnungsbegriffTypString);
c.Bound(o => o.OrdnungsbegriffWert);
c.Bound(o => o.IsProcessedString);
c.Bound(o => o.Error);
})
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(10)
.Read(r => r.Action("GetObjectsByJobId", "CrmObject", new { jobId = "#=Id#" }))
)
.Pageable()
.Sortable()
.HtmlAttributes(new { @class = "gr-crmobjects" })
.ToClientTemplate()
)
</script>
Controller-Action:
public virtual ActionResult GetJobsByProfileId(int profileId, [DataSourceRequest] DataSourceRequest request)
{
return Json(Mapper.Map<CrmJobGridVM[]>(db.GetJobsByProfileId(profileId)).ToDataSourceResult(request));
}
I'd really appreciate some help.
I would rather not deploy all /content and /script files with my project. I only want to deploy the one language and the bootstrap theme with my project. Is there an easy way to accomplish this without just removing the unused themes and languages from the project?
Jim
Hello,
I'm new to the upload extension - I'm able to upload a file async in the App_Data folder but I have the following questions:
1. how to access the filenames which I have uploaded async in the [HttpPost] ActionResult?
(sync is no problem because I have the HttpPostedFileBase Parameter)
2. how to ensure that I have unique filenames?
3. I will save the files in my database after the HttpPost - might be a solution to save the the files in a Session variable or should I save them in the App_Data temporary
robert
I have a treeview which currently shows a hierarchy of items that are different at each level. The TreeView is configured to use checkboxes and to check the children whenever the parent is checked. An example (without checkboxes) of the item types is illustrated as follows:
TypeA
TypeB
TypeB
TypeB
TypeC
TypeC
TypeB
TypeA
TypeB
Since the items vary by level, I want to write some javascript that retrieves the corresponding values by level. That is, I want to retrieve the values of all checked items at level 1, or all checked items at level 2, or all checked items for level 3. That said, I modified the code, provided by the example at: http://www.telerik.com/blogs/how-to-get-the-checked-items-from-a-treeview-with-checkboxes which recursively loops through all nodes in the treeview. Basically, the code examines each node and evaluates the 'checked' property to determine if the node has been checked. Unfortunately, the 'checked' property is undefined when only a subset of the descendants are checked. It would be nice if the node had a property indicating that at least one descendant was checked. I know that I can examine the 'hasChildren' property and recursively loop to determine if any descendant is checked, but I'm hoping that someone has a better approach. In lieu of a simple property, what is the most efficient way to determine if a node has any 'checked' descendants?
Thanks.
Mike
.
I am just starting to learn the MVC charts, and I am having a problem with the x-axis labels. I have not found the right setting to correct it. I have a line chart that may or may not go below zero on the Y-axis. The date labels are showing under $0, where they should always be at the bottom of the chart.
Here is the view:
@(Html.Kendo().Chart<tpe2.db.CFForecastData>()
.Name("chart")
.Title("Weekly Cash Flow")
.Legend(legend => legend.Position(ChartLegendPosition.Bottom))
.Tooltip(tooltip => tooltip.Visible(true))
.DataSource(ds => ds.Read(read => read.Action("CFForecastData_Read", "Chart")))
.Series(series => {
series.Line(a => a.CashBalance).Name("Cash Balance").Color("Blue").Markers(false);
series.Line(a => a.RequiredBalance).Name("Required Balance").Color("Yellow").Markers(false);
series.Line(a => a.ZeroLine).Name("Zero").Color("Red").Markers(false);
series.Line(a => a.Receipts).Name("Receipts").Color("Green").Markers(false);
series.Line(a => a.Disbursements).Name("Disbursements").Color("Black").Markers(false);
})
.CategoryAxis(axis => axis
.Categories(model => model.ReportDate)
//.AxisCrossingValue(-200000)
)
.Pannable(pannable => pannable
.Lock(ChartAxisLock.Y)
)
.Zoomable(zoomable => zoomable
.Mousewheel(mousewheel => mousewheel.Lock(ChartAxisLock.Y))
.Selection(selection => selection.Lock(ChartAxisLock.Y))
)
)
Thanks!
Mark
I found multiple examples where Master/Detail is nested in the Master Grid using hierarchy. I wanted to have two separate grids. I am using Telerik ASP.NET MVC 6 which uses Kendo UI MVC Grid. Do you have example code to implement this?
Thanks
I have a inline grid and 'sumBudgetAmount' value in a page. When user clicks edit and updates 'IncreaseByAmt' in the grid, I have to check the sum of all the records of 'IncreaseByAmt' in the grid and see it is not greater than 'sumBudgetAmount' value. I want to do client side validation on gridsave event.
I can not do server side validation as I am not updating to the database when user clicks update button. It is a batch editing where user clicks save and then I am saving all the values to the database. So I can use only client side validation.
<
span
id
=
"sumBudgetAmt"
> @(Model.SumBudgetAmount) </
span
>
@(Html.Kendo().Grid<
BHEBS.Areas.Budget.Models.ContractBudgetModel.ServiceDetailReallocation
>()
.Name("serviceDetailReallocationGrid")
.Columns(columns =>
{
columns.Bound(p => p.ServiceDetailId).Hidden(true);
columns.Bound(p => p.IncreaseByAmt).EditorTemplateName("Currency").Format("{0:c}");
columns.Command(command =>
{
command.Edit().HtmlAttributes(new { @class = "btn-primary" });
}).Width(230);
})
.Events(e => e.Save("onServiceDetailReallocationGridSave"))
.DataSource(dataSource => dataSource.Ajax().ServerOperation(false).Read(read => read.Action("ServiceDetailReallocation_Read", "ContractBudget"))
.Model(model =>
{
model.Id(p => p.ServiceDetailId);
})
.Update(update => update.Action("Update_ServiceDetailReallocation", "ContractBudget"))
.Events(e => e.Error(@<
text
> function(args) {var gridName = 'serviceDetailReallocationGrid';errorGrid(args, gridName); } </
text
>))
))
Thanks,
Veena
I have a bar chart (see attached), that I would like to display only the top 10 categories in order by alarm count. I cannot see a way to only display top N number of categories. This this possible with the bar chart?
Here is the code.
01.
@(Html.Kendo().Chart<Swisslog.DC.Entities.AlarmActivity>()
02.
.Name(
"alarmsTop10Last30"
)
03.
.Title(title => title.Text(
"TOP 10 ALARMS THE LAST 7 DAYS"
).Font(
"bold 30px Arial,Helvetica,sans-serif"
).Color(
"#808080"
).Align(ChartTextAlignment.Left))
04.
.Legend(legend => legend
05.
.Visible(
false
)
06.
.Position(ChartLegendPosition.Top)
07.
.Font(
"bold 18px Arial,Helvetica,sans-serif"
).Color(
"#808080"
)
08.
)
09.
.AutoBind(
true
)
10.
.DataSource(ds => ds
11.
.Read(read => read.Action(
"AlarmsKPIHistory"
,
"Home"
))
12.
.Group(group => group.Add(model => model.AlarmCode))
13.
//.Aggregates(agg => agg.Add(model => model.AlarmID).Count())
14.
//.Sort(sort => sort.Add(model => model.AlarmCode).Ascending())
15.
//.PageSize(10)
16.
)
17.
.Series(series =>
18.
{
19.
//series.Bar(model => model.AlarmID).Name("Alarm Description").Aggregate(ChartSeriesAggregate.Count).Color("#ED7D31");
20.
//series.Bar(model => model.AlarmID).Name("#= group.value #").Aggregate(ChartSeriesAggregate.Count).Color("#ED7D31").Stack("AlarmDescription");
21.
//series.Bar(model => model).Name("").Aggregate(ChartSeriesAggregate.Count).Color("#ED7D31");
22.
series.Bar(model => model.AlarmID).Name(
"1"
).Aggregate(ChartSeriesAggregate.Count).CategoryField(
"AlarmDescription"
);
23.
})
24.
.CategoryAxis(axis =>
25.
{
26.
//.Categories(model => model.AlarmDateTime)
27.
//.Title(title => title.Text("Date").Font("bold 18px Arial,Helvetica,sans-serif").Color("#000000"))
28.
axis.Labels(labels => labels.Rotation(0).Font(
"bold 18px Arial,Helvetica,sans-serif"
).Color(
"#808080"
));
29.
axis.MajorGridLines(lines => lines.Visible(
false
));
30.
axis.Axis.BaseUnit = ChartAxisBaseUnit.Fit;
31.
axis.Axis.MaxDateGroups = 5;
32.
axis.Axis.Type = ChartCategoryAxisType.Category;
33.
})
34.
.ValueAxis(axis => axis
35.
.Numeric()
36.
.Labels(labels => labels.Format(
"{0:N0}"
).Font(
"bold 18px Arial,Helvetica,sans-serif"
).Color(
"#808080"
))
37.
.Title(title => title.Text(
"Alarm Count"
).Font(
"bold 18px Arial,Helvetica,sans-serif"
).Color(
"#000000"
))
38.
.Max(100)
39.
.MajorUnit(10)
40.
.MajorGridLines(major => major.Visible(
true
))
41.
.Line(line => line.Visible(
false
))
42.
)
43.
.Tooltip(tooltip => tooltip
44.
.Visible(
true
)
45.
.Format(
"{0:N0}"
)
46.
)
47.
.Events(events => events
48.
.DataBound(
"onDataBound_alarmsResponds1"
)
49.
)
50.
)
Hi,
We use a framework that wrap every ajax response. Instead to have this :
AggregateResults: null
Data: [{Name: "name1", Title: "M.",},…]
Errors: null
Total: 4
the response from controller method are :
error: null
result: {data: [{name: "name1", tile: "M."},…], total: 4,…}
success: true
unAuthorizedRequest: false
I would like to use a javascript function so that can manipulate the ajax response and extract the data before passing it to the Grid.
Is there a way to achieve that? Thank you.