Hi,
I created a select list in my controller and then returned it as Json for the dropdown
Controller:
/// <summary>
/// Prepare available cargo types
/// </summary>
/// <param name="items">Cargo Type items</param>
/// <param name="withSpecialDefaultItem">Whether to insert the first special item for the default value</param>
/// <param name="defaultItemText">Default item text; pass null to use default value of the default item text</param>
public
virtual
IList<SelectListItem> PrepareAvailableCargoTypes(IList<SelectListItem> items,
bool
withSpecialDefaultItem =
true
,
string
defaultItemText =
null
)
{
if
(items ==
null
)
throw
new
ArgumentNullException(nameof(items));
var selectListItems =
new
List<SelectListItem>()
{
new
SelectListItem() { Value =
"1"
, Text =
"Dry Bulk"
},
new
SelectListItem() { Value =
"2"
, Text =
"Breakbulk"
},
new
SelectListItem() { Value =
"3"
, Text =
"Project"
},
new
SelectListItem() { Value =
"4"
, Text =
"FCL Container"
},
new
SelectListItem() { Value =
"5"
, Text =
"LCL Container"
},
new
SelectListItem() { Value =
"6"
, Text =
"Liquid Bulk"
},
new
SelectListItem() { Value =
"7"
, Text =
"RoRo"
},
new
SelectListItem() { Value =
"8"
, Text =
"Other"
}
};
items = selectListItems;
return
items;
}
public
JsonResult GetAvailableCargoTypes()
{
var model =
new
CargoMasterModel();
return
Json(PrepareAvailableCargoTypes(model.AddCargoDetailModel.AvailableCargoTypes,
false
));
}
Cshtml:
columns: [
{
field:
"CargoType"
,
title:
"Cargo Type"
,
width: 200,
editor: cargoTypeDropDownEditor,
//template: "#= #"
},
//and function
function
cargoTypeDropDownEditor(container, options) {
$(
'<input required name="'
+ options.field +
'"/>'
)
.appendTo(container)
.kendoDropDownList({
autoBind:
false
,
dataTextField:
"Text"
,
dataValueField:
"Value"
,
dataSource: {
serverFiltering:
true
,
dataValueField:
"Value"
,
transport: {
read: {
type:
"POST"
,
dataType:
"json"
,
url:
"@Html.Raw(Url.Action("
GetAvailableCargoTypes
", "
CargoAdmin
"))"
}
}
}
});
}
So far dropdown editor works great, but displays only the value. How can I make the grid display Text value of my select list based on value?
Hi,
I saw that the Scss package has a different version than the kendo version. Is there a page where we see the connection between these 2?
What I mean is for example the @progress/kendo-theme-bootstrap@3.2.0 only work with versions starting from Kendo UI R1 2019
Or is it a guaranty that the latest version of the scss file works with any version of kendo?
Hi there. I'm new to the spreadsheet component and was wondering the following. Am I able to take two javascript arrays (converted to json) and populate one starting in cell B2 and populate the other starting in cell J5, for example? I couldn't find a way to dictate the starting cell using 'datasource' and couldn't find a way to add multiple data sets into one worksheet. Thanks.
Hi all,
We are currently in a server migration procedure, which resulted in unexpected complications. In consequence, the Bower authentication procedure is failing. The responsible team is working on that issue for the past several hours. We will update the current thread with more details when we have them.
Please, excuse us for the caused inconvenience and thank you for your patience!
Hi I am trying to set the title of my dialog window dynamically but get an error
Uncaught TypeError: Cannot read property 'title' of undefined
Hello, I have buil a grid in my app and I need to filter the grid using different criteria from outside the grid. I attach an scrrenshot to clarify my issue:
I need to select something on the combobox and filter it on the client side, as well as write something on the text box and filter teh grid below.
Thank you!
Hello
I'm not sure if I'm right here but I couldn't find a topic for kendoDialog...
I have a dialog mask in my application (KendoUI, Javascript/JQuery) with two buttons: "Ok" and "Cancel". I would like to set the focus to the "Ok" button by default or at least when the dialog window is opened. I tried different things like setting .focus() on the first found .k-button, I tried to simulate a TAB command (that sets the focus to the "OK" button doing this by keyboard) on kendoDialog event "open", but everything around that didn't work. I assume that .focus() doesn't work because its not an official HTML button.
Is there a (simple) way to set the focus in a kendoDialog to a button?
Regards