I am trying to use a ClientTemplate containing a DropDownListFor in a grid. My ClientTemplate code is as follows:
@(Html.Kendo().DropDownListFor(m => m)
.DataValueField("Value")
.DataTextField("Text")
.Name("PurchaseAgreementType")
.BindTo(new List<SelectListItem>() {
new SelectListItem() {
Text = "PO Only",
Value = "PO Only"
},
new SelectListItem() {
Text = "Contract Based",
Value = "Contract Based"
}
}))
the column in the grid is shown here:
columns.Bound(l => l.PurchaseAgreementType).ClientTemplate("#=PurchaseAgreementType.Value#").Width(150);
This results in the following error: Uncaught TypeError: Cannot read property 'Value' of null
However if I copy/paste the code in the client template directly onto my form, it works perfectly.
How can I get this to work in my grid? It seems that the DDL is not populating.
Thanks.
Why setting up column's aggregates are disabling column's title?
Example in attached image.
Using the following:
Kendo UI: 2016.3.1202
Angular: 1.5.8
Chrome: 56.0.2924.87
I added a dropdownlist as specified in https://demos.telerik.com/kendo-ui/dropdownlist/addnewitem with the exception of adding the addNew function into the kendo template.
<
script
id
=
"noDataTemplate"
type
=
"text/x-kendo-tmpl"
>
<
div
>
No data found. Do you want to add new item - '#: instance.filterInput.val() #' ?
</
div
>
<
br
/>
<
button
class
=
"k-button"
onClick
=
"addNew('#: instance.element[0].id #', '#: encodeURI(instance.filterInput.val()) #');"
>Add new item</
button
>
<
script
>
function addNew(widgetId, value) {
debugger;
var widget = $("\\#" + widgetId).getKendoDropDownList();
var dataSource = widget.dataSource;
dataSource.add({
categoryID: 0,
categoryName: value
});
dataSource.one("sync", function() {
widget.select(dataSource.view().length - 1);
});
dataSource.sync();
};
</
script
>
</
script
>
I’m having two issues:
1) When clicking the add new button, the drop down shrinks to be just the 'test' item forcing the user to manual select test. This is not how the demo works, it automatically selects the new entry and closes the dropdown. (see adding_new_item(2-3) pngs) What am I doing wrong here?
2) When a user adds a leading backslash (e.g. \test ) to the ‘add new’ input the ‘add new’ flow breaks i.e. the ‘test’ gets added to the datasource but the UI just stops running; the ‘add new‘ prompt never closes. (see adding_new_item_backslash.png)
Adding the “debugger;” directly above ‘var widget’
allows me to break within the template and step through the code. Despite breaking
in this code I can’t figure out why the UI stop running as the script seems to
run to completion. Also of note once I’m stepping through the code I noticed that widget.select(dataSource.view().length - 1); always equals -1
Using
Kendo UI: 2016.3.1202
Chrome: 56.0.2924.87
Angular: 1.5.8
Implemented a dropdownlist as specified in https://demos.telerik.com/kendo-ui/dropdownlist/addnewitem with the exception of placing my addNew() in the Kendo template.
<
script
id
=
"noDataTemplate"
type
=
"text/x-kendo-tmpl"
>
<
div
>
No data found. Do you want to add new item - '#: instance.filterInput.val() #' ?
</
div
>
<
br
/>
<
button
class
=
"k-button"
onClick
=
"addNew('#: instance.element[0].id #', '#: encodeURI(instance.filterInput.val()) #');"
>Add new item</
button
>
<
script
>
debugger
function addNew(widgetId, value) {
var widget = $("\\#" + widgetId).getKendoDropDownList();
var dataSource = widget.dataSource;
dataSource.add({
categoryID: 0,
categoryName: value
});
dataSource.one("sync", function() {
widget.select(dataSource.view().length - 1); //
});
dataSource.sync();
};
</
script
>
</
script
>
While using the new "add new item" feature, if a user types in a leading back slash (e.g. \test ) the flow of the add new functionality breaks. I can add the 'test' to the widget but the UI never sets the selected value to test, just appears blank. Adding a 'debugger;' directly above datasource.one allows me to break within this code
I need to disable completely the spinner and the step, so I did the following:
http://dojo.telerik.com/AMeli
It is working great except for one problem: when clicking on arrow down, zero is displayed which is incorrect. The user did not enter zero. Please help.
Hi
I have a stacked graph and am trying to get the stack->group appearing in the Axis label without success.
Here is a dojo example - http://dojo.telerik.com/UqiVo
I am trying to get 'person 1' and 'person 2' under the relevant column (similar to how the tool tip works) as these ill be in printed reports so tooltips don't help. Best I have been able to do is put a coloured border to differentiate the series.
I have just hard coded into the label template in this example.
Thanks in advance
Dave
I downloaded Kendo version v2017.1.223 in order to get the export to Excel working, since we were using v2016.3.1028+SP1, where an exception occurred in the function toDataURL (fixed in new version according to https://github.com/telerik/kendo-ui-core/issues/2239). However, I still get the same error with the custom build that I am using. If I switch to use kendo.all.min.js, the export works.
I saw an older forum post (http://www.telerik.com/forums/what-needs-to-be-included-in-a-custom-script-to-export-to-excel) where the answer was to put ooxml before excel and treelist at end, so I did that, but the same exception still occurs.
This is the list of components that I am using with the custom build:
jquery,angular,calendar,columnmenu,columnsorter,combobox,core,data,datepicker,dom,draganddrop,ooxml,excel,filtermenu,fx,grid,groupable,list,menu,numerictextbox,pager,popup,reorderable,resizeable,selectable,sortable,splitter,tabstrip,treeview,userevents,userview,view,treelist
Please advise how to get the export to Excel to work.
When viewing a donut chart with long labels and the browser width is very narrow (like on mobile), the label is cutting off and pushing some of the other labels in the legend off the screen.
Any ideas why this is happening?
I have a custom (based on one of your examples) TimelineMonthView with a list of rooms down the left side. The top rows are the dates, and under that are the times, which all just say 12:00 AM. How can I completely hide this row of times?
Thanks!
I have a grid with a template Editor like this. My problem is when i write something in txtFirstname field and remove it, when i quit field, required message is display. When I return in this field and write something and exit the field, the validation message don't disappear. Do you know why ?
<script id="contactEditorTemplate" type="text/x-kendo-template">
<div style="width: 630px">
<p>
<label for="txtFirstname">@(New HtmlString(LocalizationValues.Firstname))</label>
<input id="txtFirstname2" name="txtFirstname" type="text" data-bind="value:Firstname" required validationMessage="@(New HtmlString(LocalizationValues.The_Firstname_Is_Mandatory))"/>
</p>
<p>
<label for="txtLastname">@(New HtmlString(LocalizationValues.Lastname))</label>
<input id="txtLastname" name="txtLastname" type="text" data-bind="value:Lastname" required validationMessage="@(New HtmlString(LocalizationValues.The_Lastname_Is_Mandatory))"/>
</p>
<p>
<label for="txtAddress">@(New HtmlString(LocalizationValues.Address))</label>
<input id="txtAddress" name="txtAddress" type="text" data-bind="value:Address" required validationMessage="@(New HtmlString(LocalizationValues.The_Address_Is_Mandatory))"/>
</p>
<p>
<label for="txtAddress2">@(New HtmlString(LocalizationValues.Address_Line2))</label>
<input id="txtAddress2" name="txtAddress2" type="text" data-bind="value:Address2" />
</p>
<p>
<div id="divQuebecCity">
<label for="city">@(New HtmlString(LocalizationValues.City))</label>
<input id="city" name="city" required data-bind="value: City" required validationMessage="@(New HtmlString(LocalizationValues.The_City_Is_Mandatory))" />
</div>
</p>
<p>
<div id="divNonQuebecCity">
<label for="txtNonQuebecCity">@(New HtmlString(LocalizationValues.City))</label>
<input id="txtNonQuebecCity" name="txtNonQuebecCity" type="text" data-bind="value: NonQuebecCity" required required validationMessage="@(New HtmlString(LocalizationValues.The_City_Is_Mandatory))"/>
</div>
</p>
<p>
<label for="txtPostalCode">@(New HtmlString(LocalizationValues.Postal_Code))</label>
<input id="txtPostalCode" name="txtPostalCode" type="text" data-bind="value: PostalCode" class="postalCode" pattern="[A-Za-z][0-9][A-Za-z] [0-9][A-Za-z][0-9]" required validationMessage="@(New HtmlString(LocalizationValues.The_Postal_Code_Format_Is_Invalid))" />
</p>
<p>
<div id="divProvince">
<label for="province">@(New HtmlString(LocalizationValues.Province))</label>
<input id="province" name="province" required data-bind="value: Province" required validationMessage="@(New HtmlString(LocalizationValues.The_Province_Is_Mandatory))" />
</div>
</p>
<p>
<label for="txtRole">@(New HtmlString(LocalizationValues.Role))</label>
<input id="txtRole" name="txtRole" type="text" data-bind="value:Role" required validationMessage="@(New HtmlString(LocalizationValues.The_Role_Is_Mandatory))"/>
</p>
<p>
<div id="divIsEmergency">
<label for="isEmergency">@(New HtmlString(LocalizationValues.IsEmergencyContact))</label>
<div id="isEmergency" name="isEmergency" data-bind="value: IsEmergency"/>
<div id="isEmergencyExplanation">
<label>@(New HtmlString(LocalizationValues.IsEmergencyInformation))</label>
</div>
</div>
</p>
<p>
<label for="divPrincipalPhoneType">@(New HtmlString(LocalizationValues.PrincipalPhoneTitle))</label>
</p>
<p>
<div id="divPrincipalPhone">
<p>
<label for="lblPrincipalPhoneType">@(New HtmlString(LocalizationValues.Type))</label>
<input id="divPrincipalPhoneType" name="divPrincipalPhoneType" required data-bind="value: PrincipalPhoneType" validationMessage="@(New HtmlString(LocalizationValues.The_Phone_Type_Is_Mandatory))" />
</p>
<p>
<label for="lblPrincipalPhoneNumber">@(New HtmlString(LocalizationValues.PhoneNumber))</label>
<input id="txtPrincipalPhoneNumber" name="txtPrincipalPhoneNumber" type="tel" pattern="[(][0-9]{3}[)] [0-9]{3}-[0-9]{4}" required data-bind="value:PrincipalPhoneNumber" class="phoneNumberMask" validationMessage="@(New HtmlString(LocalizationValues.The_Phone_Number_Is_Mandatory))" />
</p>
<p>
<label for="lblPrincipalPhoneExtension">@(New HtmlString(LocalizationValues.PhoneExtension))</label>
<input id="txtPrincipalPhoneExtension" name="txtPrincipalPhoneExtension" type="text" data-bind="value:PrincipalPhoneExtension" />
</p>
</div>
</p>
<p>
<label for="divSecondaryPhoneType">@(New HtmlString(LocalizationValues.SecondaryPhoneTitle))</label>
</p>
<p>
<div id="divSecondaryPhone">
<p>
<label for="lblSecondaryPhoneType">@(New HtmlString(LocalizationValues.Type))</label>
<input id="divSecondaryPhoneType" name="divSecondaryPhoneType" data-bind="value: SecondaryPhoneType" />
</p>
<p>
<label for="lblSecondaryPhoneNumber">@(New HtmlString(LocalizationValues.PhoneNumber))</label>
<input id="txtSecondaryPhoneNumber" name="txtSecondaryPhoneNumber" type="tel" data-bind="value:SecondaryPhoneNumber" class="phoneNumberMask" />
</p>
<p>
<label for="lblSecondaryPhoneExtension">@(New HtmlString(LocalizationValues.PhoneExtension))</label>
<input id="txtSecondaryPhoneExtension" name="txtSecondaryPhoneExtension" type="text" data-bind="value:SecondaryPhoneExtension" />
</p>
</div>
</p>
<p>
<label for="divEmailType">@(New HtmlString(LocalizationValues.EmailTitle))</label>
</p>
<p>
<div id="divEmail">
<p>
<label for="divEmailType">@(New HtmlString(LocalizationValues.Type))</label>
<input id="divEmailType" name="divEmailType" required data-bind="value: EmailType" validationMessage="@(New HtmlString(LocalizationValues.The_Email_Type_Is_Mandatory))" />
</p>
<p>
<label for="txtEmailAddress">@(New HtmlString(LocalizationValues.Email))</label>
<input id="txtEmailAddress" name="txtEmailAddress" type="email" required data-bind="value: EmailAddress" validationMessage="@(New HtmlString(LocalizationValues.The_Email_Is_Mandatory))" />
</p>
</div>
</p>
<div/>
</script>