As I've been learning about the grid, I've noticed in most of your examples, the grid is being call from a jquery ready function. Can you explain this technique, or probably better, point me to documentation that explains this to me.
Grid column filter operator list shows No Data Found when I have a column with a ClientTemplate
columns.Bound(roomIndex => roomIndex.RoomBuilding)
.Title("Building")
.EditorTemplateName("BuildingSelect")
.ClientTemplate("#=RoomBuilding.BuildingName#")
I attempted to fix the problem by adding an operator (below) but my list of filter operators is still empty and I don't understand why the above code doesn't work.
columns.Bound(roomIndex => roomIndex.RoomBuilding)
.Title("Building")
.EditorTemplateName("BuildingSelect")
.ClientTemplate("#=RoomBuilding.BuildingName#")
.Filterable(filter => filter
.Extra(false)
.UI("buildingFilter")
.Operators(operators => operators
.ForString(str => str.Clear().IsEqualTo("Is equal to"))
));
<script type="text/javascript">
function buildingFilter(element) {
element.kendoDropDownList({
dataSource: {
transport: {
read: "@Url.Action("GetSelectList", "Buildings")"
},
},
dataTextField: "BuildingName",
dataValueField: "BuildingId",
optionLabel: "--Select Value--"
});
}
</script>
Hi There,
I'm studying grid samples and don't understand why deleting a record in the ForeignKey grid sample a breakpoint on the method below is not hid during Delete operation. I ask because I replicated the same approach in my application (with Customers and Countries tables) and I get a NullReferenceException in this method every time because the last parameter is null. What am I missing?
Thanks.
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult ForeignKeyColumn_Destroy([DataSourceRequest] DataSourceRequest request,
[Bind(Prefix = "models")]IEnumerable<
ProductViewModel
> products)
{
foreach (var product in products)
{
productService.Destroy(product);
}
return Json(products.ToDataSourceResult(request, ModelState));
}
My model is quite complex but basically has a list of fields, each field then has a number of values that can be selected via a drop down. I loop through the fields and try and create a dropdown for each field:
@for (var i = 0; i < Model.Fields.Count; i++) {
var fieldId = "field_" + i.ToString() + "_value_" + j.ToString();
@(Html.Kendo().DropDownList()
.Name(fieldId)
.Value(Model.Fields[i].Values[j])
.Filter("contains")
.DataSource(source =>
{
source.Read(read =>
{
read.Action("TypeAhead", "Document", new { docType = Model.DocType, field = i });
})
.ServerFiltering(true);
})
)
The DataSource just asks the DB what the predefined (drop down) values are for this field:
public ActionResult TypeAhead([DataSourceRequest] DataSourceRequest request, string docType, int field)
{
var predefinedValues = GetPredefinedValuesForField(docType, field, "");
return Json(predefinedValues);
}
This works except that the values for the dropdown are being ADDED to each field -> i.e. field 1 has value1 and value2, field2 has value1, value2 (both from field 1) and then it's own values.
It seems as if I have not bound what comes back from the DataSource in the controller to the field but rather to each field in return?
Any ideas as to what I am doing incorrectly?
Where can I find the data that is used to feed the demos for charts? All of the chart demos have calls where I can't really see what data is being fed to the chart. For example in the Treemap demo:
public ActionResult Index_PopulationUSA()
{
return Json(TreeMapDataRepository.PopulationUSAData(), JsonRequestBehavior.AllowGet);
}
I have an autocomplete that populates with several pieces of information (Name, Type, Market Value - see attached image). I would like to format this more like a table where each column lines up under the appropriate header. I tried adding html table, tr, td etc. tags, but it did not work. Is there an example of this being done or perhaps another way of using a grid control that is populated by the autocomplete?
@(Html.Kendo().AutoComplete()
.Name("accounts")
.DataTextField("DisplayNameExtendedDetails")
.Filter("contains")
.MinLength(2)
.Placeholder("Type a name or account number")
.HtmlAttributes(new { style = "width:100%" })
.DataSource(source => source
.Custom()
.Group(g => g.Add("EntityType", typeof(string)))
.Transport(transport => transport
.Read(read =>
{
read.Action("ServerFiltering_GetAccounts", "Account")
.Data("onAdditionalData");
}))
.ServerFiltering(true))
.HeaderTemplate("<
div
class=\"dropdown-header k-widget k-header\">" +
"<
span
>Name</
span
>" +
"<
span
>Type</
span
>" +
"<
span
>Market Value</
span
>" +
"</
div
>")
.FooterTemplate("Total <
strong
>#: instance.dataSource.total() #</
strong
> items found")
.Template("<
span
class=\"k-state-default\">#: data.MarketValueFormatted # </
span
>" +
"<
span
class=\"k-state-default\"> #: data.DisplayName #</
span
>" +
"<
span
class=\"k-state-default\"> #: data.AccountType #</
span
>")
.Events(e =>
{
e.Change("onAccountChange").Select("onAccountSelect");
})
)
@(Html.Kendo().ComboBox()
.Name("engineGroupList")
.Placeholder("Select Engine Group...")
.DataTextField("EngineGroupName")
.DataValueField("EngineGroupId")
.DataSource(source =>
{
source.Read(read =>
{
read.Action("GetEngineGroups", "Equipment")
.Data("engineGroupFilter");
});
})
.CascadeFrom("customerList")
.Events(events => events.Change("engineGroupChange"))
)
@(Html.Kendo().Upload()
.Name("dasFiles")
.Async(a => a
.Save("UploadDas", "Data")
.AutoUpload(true)
.Batch(true)
).Events(events => events.Success("dasFilesSuccess")
)
function dasFilesSuccess(e) {
var grid = $("#dasFilesGrid").data("kendoGrid");
grid.dataSource.data(e.response.Data);
}
@(Html.Kendo().Grid(Model)
.Name("dasFilesGrid")
.Columns(columns =>
{
columns.Bound(m => m.FileUploadRawFileName);
columns.Bound(m => m.FileUploadGroupId).EditorTemplateName("Engine");
})
.Editable(editable => editable.Mode(GridEditMode.InCell))
.DataSource(dataSource => dataSource
.Ajax()
.Model(model =>
{
model.Id(e => e.FileUploadRawId);
})
)
)
@model List<
EngineModel
>
@(Html.Kendo().DropDownListFor(m => m)
.Name("Engine")
.DataValueField("EngineID")
.DataTextField("Model")
.BindTo((System.Collections.IEnumerable)EngineModel.All())
)
Hi
I saw a thread about not getting to the ID of a panelbar item in the OnSelect handler from 2012. I almost can't believe that Telerik did not yet fix this issue. But i can't find anything so i'm afraid they didn't.
It should be that easy to add to the component.
Eric