Given an empty radar line chart, is it possible to have the plotlines still colored as if there were data? Here's a dojo example: http://dojo.telerik.com/@buffcessna/ELoha
If you un-comment the data line, the graph looks fine. But by commenting out the data line, the entire graph is green per the plotbands.
Is there a way for the graph to be colored like the plotbands state even if there's no data present?
Question around grouping. I've noticed that when the grid's read happens it calls the assigned web method as you would expect. What I have noticed that the code below produced two different results. One for grouped data and another type for all other grid alterations (filters and sorts).
Sample code:
Dim temp As IQueryable = grid.ToDataSourceResult(request).Data.AsQueryable
No grid alterations or filtering or sorting the data type of the above object is:
System.Linq.EnumerableQuery(Of myDataType)
Apply one or more groups and the data type becomes:
System.Linq.EnumerableQuery(Of Kendo.Mvc.Infrastructure.AggregateFunctionsGroup)
Why does this happen? Have we implemented something incorrectly?
Hello,
when will be the support available for RC version?
Best Regards
Any time I try to do an update with InCell editing I get a javascript error as soon as I click out of the cell button.
function
anonymous(d) {
return
d.x.Col2
// 0x800a138f - JavaScript runtime error: Unable to get property 'Col2' of undefined or null reference
}
The d value seems to have my object (CP_FailureStrategyMatrixRow) in it just fine, i.e. it has a attribute called "Col2" that has a valid value in it. I feel everything would work just fine if it was doing "d.Col2", instead of looking in some inner value called x. But I have no idea where this "x" is coming from.
It never even gets to the server-side code:
I have tried it with both versions of the CRUD operations, as the examples on telerik seem to use both, but it doesn't seem to matter which update statement I use.
@model XDashboard.Models.GridModel
@using Kendo;
@using Kendo.Mvc;
@using Kendo.Mvc.UI;
@(Html.Kendo().Grid<
XDashboard.Models.CP_FailureStrategyMatrixRow
>()
.Name("Grid")
.Columns(columns =>
{
columns.Bound(p => p.Col1);
columns.Bound(p => p.Col2).Width(140);
columns.Bound(p => p.Col3).Width(140);
//columns.Bound(p => p.ProbabilityOfFailureValue).Width(100);
columns.Command(commands =>
{
commands.Destroy(); // The "destroy" command removes data items
}).Title("Commands").Width(200);
})
// .Events(e => e.DataBound("OnChange")) //this will attach to the events for the grid
.ToolBar(toolbar =>
{
toolbar.Create(); // The "create" command adds new data items
toolbar.Save(); // The "save" command saves the changed data items
})
.Editable(editable => editable.Mode(GridEditMode.InCell)) // Use in-cell editing mode
.DataSource(dataSource =>
dataSource.Ajax()
.Batch(false) // Enable batch updates
.Events(events => events.Error("error_handler")) //this will grab the events for the datasource, notice hwo we are inside the method for datasource
.Events(events => events.Change("OnChange"))
//.Events(events => events.Sync("OnChange"))
.Model(model =>
{
model.Id(product => product.ProbabilityOfFailureValue); // Specify the property which is the unique identifier of the model
model.Field(product => product.ProbabilityOfFailureValue).Editable(false); // Make the ProductID property not editable
})
.Create(create => create.Action("Create2", "ManagementStrats")) // Action method invoked when the user saves a new data item
.Read(read => read.Action("Read", "ManagementStrats")) // Action method invoked when the grid needs data
.Update(update => update.Action("Update2", "ManagementStrats")) // Action method invoked when the user saves an updated data item
.Events(events => events.Error("error_handler"))
.Destroy(destroy => destroy.Action("Destroy2", "ManagementStrats")) // Action method invoked when the user removes a data item
)
.Pageable()
)
<
script
type
=
"text/javascript"
>
function error_handler(e) {
if (e.errors) {
var message = "Errors:\n";
$.each(e.errors, function (key, value) {
if ('errors' in value) {
$.each(value.errors, function () {
message += this + "\n";
});
}
});
alert(message);
}
}
}
public
class
ManagementStratsController : Controller
{
public
ActionResult Index()
{
return
View();
}
public
ActionResult Read([DataSourceRequest] DataSourceRequest request)
{
XEntities db =
new
XEntities();
ManagementStratsService productService =
new
ManagementStratsService(db);
return
Json(productService.Read().ToDataSourceResult(request));
}
[AcceptVerbs(HttpVerbs.Post)]
public
ActionResult Create([DataSourceRequest] DataSourceRequest request, [Bind(Prefix =
"models"
)]IEnumerable<CP_FailureStrategyMatrixRow> products)
{
XEntities db =
new
XEntities();
ManagementStratsService productService =
new
ManagementStratsService(db);
var results =
new
List<CP_FailureStrategyMatrixRow>();
if
(products !=
null
&& ModelState.IsValid)
{
foreach
(var product
in
products)
{
productService.Create(product);
results.Add(product);
}
}
return
Json(results.ToDataSourceResult(request, ModelState));
}
[AcceptVerbs(HttpVerbs.Post)]
public
ActionResult Create2([DataSourceRequest] DataSourceRequest request, CP_FailureStrategyMatrixRow product)
{
XEntities db =
new
XEntities();
ManagementStratsService productService =
new
ManagementStratsService(db);
var results =
new
List<CP_FailureStrategyMatrixRow>();
if
(product !=
null
&& ModelState.IsValid)
{
productService.Create(product);
results.Add(product);
}
return
Json(results.ToDataSourceResult(request, ModelState));
}
//[AcceptVerbs(HttpVerbs.Post)]
//public ActionResult Update([DataSourceRequest] DataSourceRequest request, CP_FailureStrategyMatrixRow product)
//{
// if (product != null && ModelState.IsValid)
// {
// XEntities db = new XEntities();
// ManagementStratsService productService = new ManagementStratsService(db);
// }
// return Json(new[] { product }.ToDataSourceResult(request, ModelState));
//}
[AcceptVerbs(HttpVerbs.Post)]
public
ActionResult Update([DataSourceRequest] DataSourceRequest request, [Bind(Prefix =
"models"
)]IEnumerable<CP_FailureStrategyMatrixRow> products)
{
XEntities db =
new
XEntities();
ManagementStratsService productService =
new
ManagementStratsService(db);
if
(products !=
null
&& ModelState.IsValid)
{
foreach
(var product
in
products)
{
productService.Update(product);
}
}
return
Json(products.ToDataSourceResult(request, ModelState));
}
[AcceptVerbs(HttpVerbs.Post)]
public
ActionResult Update2([DataSourceRequest] DataSourceRequest request, CP_FailureStrategyMatrixRow product)
{
XEntities db =
new
XEntities();
ManagementStratsService productService =
new
ManagementStratsService(db);
if
(product !=
null
&& ModelState.IsValid)
{
productService.Update(product);
}
return
Json(
new
[] { product }.ToDataSourceResult(request, ModelState));
}
[AcceptVerbs(HttpVerbs.Post)]
public
ActionResult Destroy([DataSourceRequest] DataSourceRequest request, [Bind(Prefix =
"models"
)]IEnumerable<CP_FailureStrategyMatrixRow> products)
{
XEntities db =
new
XEntities();
ManagementStratsService productService =
new
ManagementStratsService(db);
if
(products !=
null
&& ModelState.IsValid)
{
foreach
(var product
in
products)
{
productService.Destroy(product);
}
}
return
Json(products.ToDataSourceResult(request, ModelState));
}
[AcceptVerbs(HttpVerbs.Post)]
public
ActionResult Destroy2([DataSourceRequest] DataSourceRequest request, CP_FailureStrategyMatrixRow product)
{
XEntities db =
new
XEntities();
ManagementStratsService productService =
new
ManagementStratsService(db);
if
(product !=
null
&& ModelState.IsValid)
{
productService.Destroy(product);
}
return
Json(
new
[] { product }.ToDataSourceResult(request, ModelState));
}
//public ActionResult Unique(string field)
//{
// var result = GetCP_FailureStrategyMatrixRows().Distinct(new CP_FailureStrategyMatrixRowComparer(field));
// return Json(result, JsonRequestBehavior.AllowGet);
//}
}
public
class
CP_FailureStrategyMatrixRow
{
public
int
ProbabilityOfFailureValue {
get
;
set
; }
public
string
Col1 {
get
;
set
; }
public
string
Col2 {
get
;
set
; }
public
string
Col3 {
get
;
set
; }
public
string
Col4 {
get
;
set
; }
public
string
Col5 {
get
;
set
; }
public
string
Col6 {
get
;
set
; }
public
string
Col7 {
get
;
set
; }
public
string
Col8 {
get
;
set
; }
public
string
Col9 {
get
;
set
; }
public
string
Col10 {
get
;
set
; }
internal
CP_FailureStrategyMatrix_Test transform()
{
CP_FailureStrategyMatrix_Test row =
new
CP_FailureStrategyMatrix_Test();
row.Col1 = Col1.Length == 1 ? (
int
?)(Char.GetNumericValue(Col1[0]) - 64) :
null
;
row.Col2 = Col2.Length == 1 ? (
int
?)(Char.GetNumericValue(Col2[0]) - 64) :
null
;
row.Col3 = Col3.Length == 1 ? (
int
?)(Char.GetNumericValue(Col3[0]) - 64) :
null
;
row.Col4 = Col4.Length == 1 ? (
int
?)(Char.GetNumericValue(Col4[0]) - 64) :
null
;
row.Col5 = Col5.Length == 1 ? (
int
?)(Char.GetNumericValue(Col5[0]) - 64) :
null
;
row.Col6 = Col6.Length == 1 ? (
int
?)(Char.GetNumericValue(Col6[0]) - 64) :
null
;
row.Col7 = Col7.Length == 1 ? (
int
?)(Char.GetNumericValue(Col7[0]) - 64) :
null
;
row.Col8 = Col8.Length == 1 ? (
int
?)(Char.GetNumericValue(Col8[0]) - 64) :
null
;
row.Col9 = Col9.Length == 1 ? (
int
?)(Char.GetNumericValue(Col9[0]) - 64) :
null
;
row.Col10 = Col10.Length == 1 ? (
int
?)(Char.GetNumericValue(Col10[0]) - 64) :
null
;
row.ProbabilityOfFailureValue = ProbabilityOfFailureValue;
return
row;
}
//public partial class CP_FailureStrategyMatrix_Test
//{
// public int ProbabilityOfFailureValue { get; set; }
// public Nullable<int> Col1 { get; set; }
// public Nullable<int> Col2 { get; set; }
// public Nullable<int> Col3 { get; set; }
// public Nullable<int> Col4 { get; set; }
// public Nullable<int> Col5 { get; set; }
// public Nullable<int> Col6 { get; set; }
// public Nullable<int> Col7 { get; set; }
// public Nullable<int> Col8 { get; set; }
// public Nullable<int> Col9 { get; set; }
// public Nullable<int> Col10 { get; set; }
//}
}
Every time the chart is drawn the background is set to gray. No matter if the theme is specified or not or if the chart area background is set to "", "transparent" or any color, or not at all.
You can see a blank chart with the correct background color prior to the read occurring and the chart being redrawn with the appropriate data. Each path element in the SVG has a stroke color set to "#dfdfdf"
Here is the code:
@(Html.Kendo( ).Chart<ViewModels.HistoryChartModel>( )
.Name( "chart" )
.ChartArea(c=>c.Width(800).Height(600))
.DataSource( dataSource => dataSource
.Read( read => read.Action( "Series", "Home" ) )
.Group( group => group.Add( model => model.BasinName ) )
.Sort( sort => sort.Add( model => model.ReadingDateTime ).Descending( ))
)
.Series( series => {series.Line( model => model.LevelReading ).Name( "#= group.value # " ).Markers(false);} )
.Legend( legend => legend.Position( ChartLegendPosition.Bottom ))
.ValueAxis( a => a.Numeric( ).Min( 3 ).Max(10).MinorTicks(mt=>mt.Visible(false)).MajorUnit(.5) )
)
public JsonResult GetCustomers()
{
return
Json(CustomerRepository.Repository.Customers, JsonRequestBehavior.AllowGet);
}
public JsonResult GetVendors(int customerId,int customerId2)
{
return
Json(VendorRepository.Repository.GetVendorsByCustomer(customerId), JsonRequestBehavior.AllowGet);
}
function
filterVendors() {
return
{
customerId: $(
"#CustomerId"
).data(
"kendoAutoComplete"
).value(),
customerId2: $(
"#CustomerId"
).data(
"kendoAutoComplete"
).value(),
};
}
function
filterProducts() {
return
{
vendorId: $(
"#VendorId"
).data(
"kendoDropDownList"
).value()
};
}
<
dl
>
<
dt
>
@Html.LabelFor(m => m.CustomerId):
</
dt
>
<
dd
>
@(Html.Kendo().AutoCompleteFor(m => m.CustomerId).Name("CustomerId")
.ValuePrimitive(true)
.DataTextField("CustomerId")
.DataSource(dataSource =>
{
dataSource.Read(read => read.Action("GetCustomers", "Home"))
.ServerFiltering(true);
})
)
@Html.ValidationMessageFor(m => m.CustomerId)
</
dd
>
</
dl
>
<
dl
>
<
dt
>
@Html.LabelFor(m => m.VendorId):
</
dt
>
<
dd
>
@(Html.Kendo().DropDownListFor(m => m.VendorId)
.AutoBind(false)
.ValuePrimitive(true)
.OptionLabel("Select Vendor...")
.DataTextField("VendorName")
.DataValueField("VendorId")
.DataSource(dataSource =>
{
dataSource.Read(read => read.Action("GetVendors", "Home").Data("filterVendors"))
.ServerFiltering(true);
})
.CascadeFrom("CustomerId")
)
@Html.ValidationMessageFor(m => m.VendorId)
</
dd
>
</
dl
>
Can I give a dropdownlist's CascadeFrom parameter a AutoComplete? I have tried it but it didn't work.
public
JsonResult GetCustomers()
{
return
Json(CustomerRepository.Repository.Customers, JsonRequestBehavior.AllowGet);
}
public
JsonResult GetVendors(
int
customerId,
int
customerId2)
{
return
Json(VendorRepository.Repository.GetVendorsByCustomer(customerId), JsonRequestBehavior.AllowGet);
}
function
filterVendors() {
return
{
customerId: $(
"#CustomerId"
).data(
"kendoAutoComplete"
).value(),
customerId2: $(
"#CustomerId"
).data(
"kendoAutoComplete"
).value(),
};
}
function
filterProducts() {
return
{
vendorId: $(
"#VendorId"
).data(
"kendoDropDownList"
).value()
};
}
<
dl
>
<
dt
>
@Html.LabelFor(m => m.CustomerId):
</
dt
>
<
dd
>
@(Html.Kendo().AutoCompleteFor(m => m.CustomerId).Name("CustomerId")
.ValuePrimitive(true)
.DataTextField("CustomerId")
.DataSource(dataSource =>
{
dataSource.Read(read => read.Action("GetCustomers", "Home"))
.ServerFiltering(true);
})
)
@Html.ValidationMessageFor(m => m.CustomerId)
</
dd
>
</
dl
>
<
dl
>
<
dt
>
@Html.LabelFor(m => m.VendorId):
</
dt
>
<
dd
>
@(Html.Kendo().DropDownListFor(m => m.VendorId)
.AutoBind(false)
.ValuePrimitive(true)
.OptionLabel("Select Vendor...")
.DataTextField("VendorName")
.DataValueField("VendorId")
.DataSource(dataSource =>
{
dataSource.Read(read => read.Action("GetVendors", "Home").Data("filterVendors"))
.ServerFiltering(true);
})
.CascadeFrom("CustomerId")
)
@Html.ValidationMessageFor(m => m.VendorId)
</
dd
>
</
dl
>
I have a Razor for that has several Autocomplete fields on it.
Some of these fields are required, some are not required.
I need to show the required fields in a red border and a blue background, while non-required fields are white, with a blue border.
My css works for a regular text field, but i cannot figure out how to make it work for an autocomplete field.
How would I do that? I have tried " .HtmlAttributes(new { @class="rsireqtext",style = "width: 99%;" }) " in the autocomplete (rsireqtext is my 'required' styling),
but that doesn't do it.
Any ideas?
TIA,
Bob Mathis