Telerik Forums
Kendo UI for jQuery Forum
4 answers
448 views

I have a view where I am dynamically adding a number of textareas when the view loads.

I am then creating an editor out of all them by applying: $(".im_editor").kendoEditor({  ...

This is working fine, but next I need to add several dropdowns to the toolbars to insert html from several different categories.

It was quickly apparent that the "insertHtml" tool would not work as it can only be used once per editor (although does function in each of the rendered editors).

Next I tried using the "customTemplate" tool following the example on the Demos page.

This works fine on the first rendered editor, but does not render properly or function on the remaining editors.

Can someone provide assistance on how to accomplish this?  

 

@foreach(var sec in Model.Sections)
{
    <div class="internalapproval_investmemo_sectitle">@sec.SectionName</div>
    <table sectionid="@sec.SectionID">
        @foreach(var entry in Model.Entries.Where(e => e.SectionID == sec.SectionID).OrderBy(e => e.EntrySeqNo))
        {
            <tr>
                <td entryid="@(sec.SectionID.ToString() + "_" + entry.EntryID)">
                    <textarea id="@sec.TextAreaName" name="@("sec" + sec.SectionID.ToString())" class="im_editor" style="height:150px;">@(HttpUtility.HtmlDecode(entry.EntryText))</textarea>
                </td>
            </tr>
        }                                        
    </table>
}

<script type="text/x-kendo-template" id="insertToken-template">
    <select id='insertTokens' style='width:110px'>
        <option value=''>Insert token</option>
        <option value='{token: dealname}'>Deal Name</option>
        <option value='{token: dealtype}'>Deal Type</option>
        <option value='{token: sectortype}'>Sector Type</option>
    </select>
</script>

<script>   

    $(document).ready(function () {

        $(".im_editor").kendoEditor({
            resizable: { content: true },
            tools: [
                "bold",
                "italic",
                "underline",
                { name: "insertHtml",
                    items: [
                        { text: "token: UPB", value: "{token: upb}" },
                        { text: "token: Investment", value: "{token: investment}" }
                    ]
                },
                {
                    name: "customTemplate",
                    template: $("#insertToken-template").html()
                }
            ]
        });

        $("#insertTokens").kendoDropDownList({
            change: function (e) {
                var editor = $(".im_editor").data("kendoEditor");
                editor.exec("inserthtml", { value: e.sender.value() });
                console.log("change fired");
            }
        });

    });
</script>

Nencho
Telerik team
 answered on 29 Jan 2019
1 answer
144 views

I am playing around with default-v2 SASS for jquery and I noticed that placeholder or textbox focus/blur behave differently between standard input and input with icon.

<input class="k-textbox" placeholder="enter criteria" />

First example looks more "correct". Placeholder color is lighter. Box also gets a shadow on focus.

<span class="k-textbox k-space-right">
  <input placeholder="enter criteria" />
  <span class="k-icon k-i-search"></span>
</span>

Second example differes in a way it is flat. Placeholder is same color as text (confusing for user), box doesn't get any shadow on focus.

Is this a limitation or just a style misconfiguration? How can we make this to be consistent?

quick demo:

https://dojo.telerik.com/UmuwUYeJ

 

Dimitar
Telerik team
 answered on 29 Jan 2019
6 answers
1.1K+ views

My grid is showing the ID in a column. The ID however is coming from the database and can't be changed. Also, the database creates it when adding a new item.

In other words: editing the ID when adding or editing a new item makes no sense.

How can I achieve this?

 

Here is what I tried:

@(Html.Kendo().Grid<DepartmentModel>()
      .Name("departmentsGrid")
      .HtmlAttributes(new { @class = "controls-default" })
      .Columns(c =>
      {
          c.Bound(x => x.Id);
          c.Bound(x => x.Name);
          c.Bound(x => x.Description);
          c.Command(b =>
          {
              b.Edit();
              b.Destroy();
          });
      })
      .ToolBar(b => b.Create())
      .Editable(b => b.Mode(GridEditMode.PopUp))
      .Sortable()
      .Scrollable()
      .Pageable(x => x.Refresh(true).PageSizes(true).ButtonCount(5))
      .DataSource(b => b.Ajax()
                        .Model(model =>
                        {
                            model.Id(x => x.Id);
                            model.Field(x => x.Id).Editable(false);
                        })
                        .Read(x => x.Action("ReadDepartments", "Departments").Data("getReadDepartmentsParameters"))
                        .Create(x => x.Action("CreateDepartment", "Departments"))
                        .Update(x => x.Action("UpdateDepartment", "Departments"))
                        .Destroy(x => x.Action("DeleteDepartment", "Departments"))))

 

 

Borja
Top achievements
Rank 1
 answered on 29 Jan 2019
1 answer
339 views

Dear Telerik Forum

We have a problem with two virtual cascaded dropdown lists.
I gave an example where one dropdown list contains Swiss cities and the second dropdown list contains the corresponding postal codes.
Depending on the selected city, the drop-down menu with the postal codes should only show those that exist in the selected city. This also works as long as the second is not loaded virtual. As soon as the second dropdown is loaded virtual an error occurs, 'c is not a function'. Without the 'data-virtual' option it works fine again.

http://dojo.telerik.com/EQUDOBUg/4

Thank you very much

Best regards

Dimitar
Telerik team
 answered on 29 Jan 2019
2 answers
236 views

Is there a way to bind a tabstrip data item badge?  For example, I want the tab header to be "Tab Header" having a badge = 10 but be able to update it via code.

div id="data-div">
    <kendo-tabstrip name="tabstrip">
        <items>
            <tabstrip-item selected="true" data-bind="text: tab1Header">
                <content>
                    <p>Content</p>
                </content>
            </tabstrip-item>
        </items>
    </kendo-tabstrip>
</div>
 
<script>
 
    var viewModel = kendo.observable({
        tab1Header: "Tab Header",
        //tab1Header: "Tab Header <span class='Valid'>10</span>" -- doesn't work, displays raw text,
        tab1Badge: "10"   // Need to bind this to the badge class for the first tab
    });
 
    kendo.bind($("#data-div"), viewModel);
 
</script>

 

 

Testing

Nencho
Telerik team
 answered on 28 Jan 2019
4 answers
1.1K+ views
I simply want to change the background color of Kendo UI Menu.
Also I want to control the color of each item in the Menu bar.
How can I make it possible? Please help me.
Joel
Top achievements
Rank 3
Bronze
Iron
Iron
 answered on 25 Jan 2019
1 answer
114 views

Hi, 

Our business user is asking us to provide a list of charts we can do with kendo.  But current our application is still using the old Kendo JQuery library of version 2016.3.914. Could you please provide a list of charts that the old version supported. Since the page on your website is always  showing the components of  most recently version. 

https://demos.telerik.com/kendo-ui/

 

Thanks.

 

Alex Hajigeorgieva
Telerik team
 answered on 25 Jan 2019
3 answers
3.1K+ views

Hi there,

I have a dropdownlist control which list all records fetched from a remote data source.   The code below shows the  creation of data source, fetch data and, populates the dropdownlist with records.

getSchedules(): void {
            const schedulesData = new kendo.data.DataSource({
                transport: {
                    read: {
                        url: "/.../Schedules?entityName=someEntity",
                        cache: false,
                        dataType: "json",
                        contentType: "application/json",
                        type: "GET",
                        headers: window["authenticationBearerToken"]
                    }
                },
                autoSync: true,
                serverFiltering: true,
                error: (e: kendo.data.DataSourceErrorEvent) => {
                    console.log(e);
                }
            });
            schedulesData.fetch().then(() => {
                const schedules = schedulesData.data()[0];
                if (schedules !== undefined && schedules !== null) {
                    // Bind dropdown list to list of schedules
                    $("#schedules").kendoDropDownList({
                        optionLabel: "Choose available schedule",
                        dataTextField: "Name",
                        dataValueField: "ScheduleId",
                        dataSource: schedulesData.data(),
                        autoBind: false,
                        index: 0
                    });
                }
                else {
                    $("#schedules").kendoDropDownList({
                        optionLabel: "No available schedule",
                        dataTextField: "Name",
                        dataValueField: "ScheduleId",
                        dataSource: null,
                        autoBind: false,
                        index: 0
                    });
                }
            }).fail((error) => {
                console.log(error);
            });

 

As such, when a user creates a new schedule, the dropdownlist control should append the newly added schedule without doing a page refresh.  The problem is that, after creating a new schedule, dropdownlist datasource read method didn't work at all.  Code below for posting new schedule

const scheduleCreate: () => void = (): void => {
                        $.ajax({
                            type: "POST",
                            url: baseUrl + `AddSchedule?scheduleData=${scheduleData}`,
                            contentType: "application/json",
                            dataType: "json",
                            cache: false,
                            beforeSend: () => { }
                        }).done((result: any) => {
                            console.log(result);
 
                            window["UserDialog"](result.message, "OK", undefined);
                            isSuccess = result.isSuccess;
 
                            if (result.isSuccess) {
                                // refresh schedule's dropdown list
                                const schedulesDropdownList = $("#schedules").data("kendoDropDownList");
 
                                schedulesDropdownList.dataSource.read();
                                schedulesDropdownList.refresh();
                             }
                        }).fail((error: any) => {
                            console.log(error);
                        });
                    };

 

I tried several examples in Kendo UI dropdownlist API documentation, but no luck at all.  I also searched in telerik forums but couldn't find any related issues.

What seems go wrong in my dropdownlist configuration? or is there lacking in the datasource config?

Please help.

 

 

 

 

 

 

Joana
Telerik team
 answered on 25 Jan 2019
9 answers
9.6K+ views
Hi, 

How can I align, center and define the width of a grid cell

Thanks in advance
Ed
Top achievements
Rank 1
 answered on 25 Jan 2019
1 answer
533 views

Hello support,

With me updating to Kendo.Mvc.dll 2018.3.1219.545 I'm getting som Code CS1702 warnings (see screenshot) when using kendo widgets tag helpers (i.e. @(Html.Kendo().DropDownListFor or Html.Kendo().DatePickerFor).

I have System.Web.Mvc version 5.2.7.0 referenced in the asp.net mvc 5 project and in my root web.config I have this entry in my <runtime> section:

    <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-5.2.7.0" newVersion="5.2.7.0" />
      </dependentAssembly>

I'm not sure how to fix these warnings. Can you help?

Thanks in advance

Best regards

Morten

Dimitar
Telerik team
 answered on 25 Jan 2019
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?