Telerik Forums
Kendo UI for jQuery Forum
0 answers
152 views

Hi Team,

 

how can I connect a label to color-picker using "for" attribute? currently even though its linked, screen reader(accessibility) does not read the label for color-picker.

appreciate any help.

ashutosh
Top achievements
Rank 1
Iron
Veteran
 asked on 27 Sep 2021
1 answer
535 views

I have a grid use Kendo Grid. When i custom edit event and add event to input in edit mode like this

edit: function (e) {
                        if (e.container[0]) {
                            var cell = e.container[0]
                            $rootScope.rowToFocus = angular.element(cell).closest('tr').index();
                            $rootScope.colToFocus = e.sender.cellIndex(angular.element(cell).closest('td'));
                            if ($rootScope.rowToFocus != 0 || $rootScope.colToFocus != 0) {
                                $rootScope.gridToFocus = e.sender;
                                e.container.find("input").on("keydown", function (ev) {
                                    if (ev.which == 9 || ev.which == 13) {
                                        $rootScope.isKeyboard = true;

                                        ev.preventDefault();

                                     }  
                                })
                            }
                            else {
                                $rootScope.rowToFocus = undefined;
                                $rootScope.colToFocus = undefined;
                            }
                        }
                    }, 

So i prevented default of tab event but aslo prevent update the data i input in this... Please help me a solution to prevent tab event in my input and still raise the update data event when i leave this cell.

Georgi Denchev
Telerik team
 answered on 27 Sep 2021
1 answer
77 views

Hello, I have detail row that appears perfectly, except when the master row is at the bottom of the container (or screen).  The detail row still opens, but requires scrolling to see it.

How can I auto scroll far enough to get the detail row to show, when the detail row is outside of the bounding container or screen?

Thanks.

Georgi Denchev
Telerik team
 answered on 24 Sep 2021
2 answers
906 views

We have a use case where users are choosing which values they'd like to concatenate together, from a list of options.

At times, they may need to concatenate the same thing more than once

Kendo's multiselect seems like the best component for this

... but I'm getting stuck on customizing it's behavior to allow the same value to repeat, when CTRL + CLICK takes place.

  • click - should add/remove choices per the usual
  • CTRL + CLICK should push the choice onto the multiselect, regardless if the multiselect already has that choice
    • Observe whether or not CTRL has been engaged
    • rewrite normal deselect handler to honor the required CTRL + CLICK behavior

Things are very close to working, but am unable to get the MultiSelect to dynamically update its value correctly, using Kendo's value() method.

 

Offending line of code attached in screenshot

and sample Dojo here -> https://dojo.telerik.com/ELeligEY/14


Am I missing something w/ Kendo's API? Should I be approaching this with a different Kendo component? 


UPDATE: from scrounging the forums, it appears an underlying architectural design means MultiSelect inherits from something that does not allow repeating values? https://www.telerik.com/forums/allow-duplicate-items

Help with this feature request would be much appreciated.
https://feedback.telerik.com/kendo-jquery-ui/1359475-allow-select-items-in-multiselect-multiple-times

Or guidance on how one might customize the Kendo Multiselect to achieve this kind of use case.

Help much appreciated.

Caleb
Top achievements
Rank 1
Iron
 answered on 24 Sep 2021
0 answers
68 views

I have a TreeList and a connected ContextMenu.   The context menu shows correctly the first time only when clicking on a TreeList row.  After that however, no matter where I right-click on the page, the context menu is displayed.


@(Html.Kendo().ContextMenu()
    .Name("orgtreemenu")
    .Target("#OrganizationTreeMaintenance")
    .Orientation(ContextMenuOrientation.Vertical)
    .Filter(".k-grid-content table tbody tr[role='row']")
    .Events(e => e
        .Open("orgContextMenuOpen")
        .Select("orgTreemenuSelect")
    )
    .Items(items =>
    {
        items.Add()
            .Text("Add Organization")
            .HtmlAttributes(new { @id = "addorgaction" })
            .Enabled(true);
        items.Add()
            .Text("Edit Name")
            .HtmlAttributes(new { @id = "editorgnameaction" })
            .Enabled(true);
        items.Add()
            .Text("Delete Organization")
            .HtmlAttributes(new { @id = "deleteorgaction" })
            .Enabled(true);

        items.Add()
            .Text("Move Organization")
            .HtmlAttributes(new { @id = "moveorgaction" })
            .Enabled(false);
    }))
@(Html.Kendo().TreeList<UserStatViewModel>()
    .Name("OrganizationTreeMaintenance")
    .Columns(columns =>
    {
        columns.Add().Field(e => e.OrganizationName).Width(300);
        columns.Add().Field(e => e.OrganizationId).Hidden(true);
        columns.Add().Field(e => e.TotalUserCount).Title("Users");
        columns.Add().Field(e => e.TotalDeviceCount).Title("Devices");
        columns.Add().Field(e => e.LicensedUserCount).Title("Licenses");
    })
    .Sortable()
    .HtmlAttributes(new { style = "height:500px;" })
    .Events(e => e
        .DataBound("onDataBoundLicenseTree"))
    .DataSource(dataSource => dataSource
        .Read(read => read.Action("GetOrgLicenseDetails", "home"))
        .ServerOperation(false)
        .Model(m =>
        {
            m.Id(f => f.OrganizationId);
            m.ParentId(f => f.ParentOrgId).DefaultValue(0);
            //           m.Expanded(true);
            m.Field(f => f.OrganizationName);
            m.Field(f => f.TotalDeviceCount);
            m.Field(f => f.ParentOrgId);
        })
    ))

I have tried modifying the Filter on the context menu to no avail.  Hoping someone can see something obvious.

Thanks and regards,

Eric Katz

Eric
Top achievements
Rank 1
 asked on 23 Sep 2021
1 answer
510 views

Hi team, 

I was able to generate the model and columns and grid dynamically using the articles

Adding to this I want to add a column to the front of the grid with a checkbox against each row. 

I need to add a master checkbox in that column, which can select all of the rows if grid.

How do I achieve this? I tried, but I am not able to have the column visible.

Please help!.

 

Thanks

 

Martin
Telerik team
 answered on 23 Sep 2021
1 answer
470 views

Using a "destroy" command in the datagrid and "autoSync: false", it somehow calls the "destroy" twice. Any idea if I'm doing something wrong? When I set autoSync to true, it only fires once.

The following config gives me:

destroy
destroy
success
success
destroy: (options) => {
    console.log("destroy");
    $.ajax({
        url: $discountProductsGrid.data("delete-url"),
        dataType: "json",
        contentType: 'application/json',
        type: "POST",
        data: kendo.stringify({
            discountNumber: options.data.discountNumber,
            productNumber: options.data.productNumber,
            productColorId: options.data.productColorId,
            productSizeId: options.data.productSizeId,
        }),
        success: (result) => {
            console.log("success");
            options.success(result);
        },
        error: (result) => {
            console.log("error");
            options.error(result);
        },
    });
},

I do have sorting, filtering, and paging on the server, though I don't expect that to matter.

My model isn't very complicated and I've verified that there are no double IDs. At first I was thinking that perhaps the response body was incorrect, but that shouldn't be a problem because it fires the same destroy twice and doesn't wait for the first destroy to finish.

kendo.data.Model.define({
    id: "discountLineId",
    fields: {
        discountLineId: {type: "string"},
        discountNumber: {type: "number"},
        productSupplierName: {type: "string"},
        productCategoryDescription: {type: "string"},
        productNumber: {type: "number"},
        productId: {type: "string"},
        productDescription: {type: "string"},
        productColorId: {type: "string"},
        productColorDescription: {type: "string"},
        productSizeId: {type: "string", nullable: true},
        productSizeDescription: {type: "string", nullable: true},
        discountSalesPrice: {type: "number"},
        productSalesPrice: {type: "number"},
        discountSalesPricePercentage: {type: "number"},
    }
})
The method I use for saving:
$discountLineGrid.on("click", ".k-grid-save-changes", (e) => {
    e.preventDefault();

    discountLineGrid.saveChanges();

    // sync also firesd 
    // discountLineDataSource.sync();
});

I've verified inside the data source (in the range part), that the data is only 19 and that only the one record is that has to be deleted is still in the prestine data or whatever that is.
Martin
Telerik team
 answered on 23 Sep 2021
1 answer
1.2K+ views

I have a Kendo grid that uses Export-to-excel and Export-to-pdf.

One particular column consists of data with padded zeros (so that column sorting works). Then, this column uses a template to display the data without the padded zeros (a business requirement). This is perfect for the grid.

Now, the export functions do not export the template, they export the underlying data (this is documented in the Known Limitations). So my exports show the data with padded-zeros. But... I need to show the data without padded zeros. So I have been looking for a workaround.

Workaround attempt A)
I created two columns padded and non-padded. The idea was this:
Column i/ Data = padded; Grid view = non-padded; do not export.
Column ii/ Data = non-padded; Grid view = hidden; export.

However, this doesn't work for two reasons. 
Column i/ columns: exportable: { pdf: false, excel: false } doesn't actually seem to work(!!!)
Column ii/ This isn't legal anyway. If you hide the data in the grid you can't export it anyway.

Workaround attempt B)
In the excelExport() function I did this:

      excelExport: function (e) {
        for (var j = 0; j < e.data.length; j++) {
e.data[j].padded_column = e.data[j].non-padded_column;
        }
      },

In the console this appears to work fine, that is I replace the value of the padded column with the data of the non-padded column. However, it makes no difference to what appears on the spreadsheet. My guess is that this is because the spreadsheet has already been generated before excelExport() modifies the data.

So, I need a new approach. Can anybody help?

ADDITIONAL INFORMATION

For further reference, here is the code for the column:

      columns: [{
          field: 'sys_id_sorted', 
          title: 'File ref',
          hidden: false,
          template: function (dataItem) {
            var ctyClass = '';
            switch (dataItem.cty_id) {
              case '1':
                ctyClass = 'CHAP';
                break;
              case '2':
                ctyClass = 'EU-PILOT';
                break;
              case '3':
                ctyClass = 'NIF';
                break;
              case '4':
                ctyClass = 'OTHER';
                break;
              default:
                ctyClass = 'default';
                break;
            }
            return '<div class="label label-' + ctyClass + ' origin">' + dataItem.sys_id + '</div>';
          }
        },

'sys_id_sorted' is the field that has padded zeros.
'dataItem.sys_id' is the field with no padded zeros.      
Nikolay
Telerik team
 answered on 23 Sep 2021
1 answer
4.0K+ views

I have implemented a grid with inline editing, which has a dropdown in one of its columns. The problem is, everytime I am trying to save a change I made, I get the following TypeError and I think it is the dropdown which causes this:

kendo.all.js:6412 Uncaught TypeError: Cannot read properties of undefined (reading 'data')
    at init.setup (VM13051 kendo.all.min.js:formatted:4953)
    at init.update (VM13051 kendo.all.min.js:formatted:4946)
    at Object.<anonymous> (VM13051 kendo.all.min.js:formatted:5531)
    at Function.Deferred (VM12816 AJS097.P:528)
    at init._promise (VM13051 kendo.all.min.js:formatted:5526)
    at init._send (VM13051 kendo.all.min.js:formatted:5557)
    at init.sync (VM13051 kendo.all.min.js:formatted:5341)
    at init.saveRow (VM13051 kendo.all.min.js:formatted:48900)
    at init._editUpdateClick (VM13051 kendo.all.min.js:formatted:48689)
    at HTMLAnchorElement.proxy (VM12816 AJS097.P:65)

Here is the implementation of the grid (I tried to keep it as simple as I could, by removing anything that might be unnecessary for this problem):

jq(document).ready(function() { var copyBool = false grid_counter = 0; jq("#inline_grid").kendoGrid({ autoBind: true, dataSource: { transport: { read: { url: "GetJsonData_Grid.p", dataType: "json", data:{ "function": "testfunction", "element": "grid", "param1": "testparam1", "param2": "", "param3": "", "rowid": $("rowid").value } } }, schema: { data: "data", total: "recordsCount", model: { id: "field1", fields: { field1: { type: "string", validation: { required: true, maxlength: "3", field1validation: function(input) { var grid_length = jq("#inline_grid").data("kendoGrid").dataSource.data().length + 1; if(input.is("[name='field1']") && input.val() == "0") { input.attr("data-field1validation-msg","the number must be greater than 0"); returnfalse; } elseif(input.is("[name='field1']") && input.val() == "") { input.attr("data-field1validation-msg","the number must not be empty"); returnfalse; } elseif(input.is("[name='field1']") && (input.val() < "0" || input.val() > "99999999")) { input.attr("data-field1validation-msg","the input is invalid"); input.val(grid_length); returnfalse; } returntrue; } } }, field2: { type: "string", validation: { required: false }}, field3: { type: "string", validation: { required: false }}, field4: { type: "string", validation: { required: false }}, field5: { type: "string", validation: { required: false }}, field6: { type: "string", validation: { required: false }} } } }, pageSize: 15 }, toolbar: [ { name: "create", text: "Add", iconClass: "" }, ], dataBound: function(e) { if(grid_counter == 0) { this.select("tr:eq(0)"); grid_counter++; } }, selectable: true, change: function(e) { var selectedRows = this.select(), dataItem = this.dataItem(selectedRows[0]); ... }, sortable: false, scrollable: { virtual: true }, persistSelection: true, columns: [ { field: "field1", title: "nr", width: "30px", attributes: {style: "text-align:left;"}, headerAttributes: {style: "text-align:left;"}, editor: textEditor }, { field: "field2", title: "active", width: "20px", attributes: {style: "text-align:left;"}, headerAttributes: {style: "text-align:left;"}, editor: cbEditor }, { field: "field3", title: "art", width: "100px",attributes: {style: "text-align:left;"}, headerAttributes: {style: "text-align:left;"}, editor: ddlEditor }, { field: "field4", title: "description", width: "100px",attributes: {style: "text-align:left;"}, headerAttributes: {style: "text-align:left;"}, editor: textEditor }, { field: "field5", title: "comment", width: "100px",attributes: {style: "text-align:left;"}, headerAttributes: {style: "text-align:left;"}, editor: textEditor }, { field: "field6", title: "processed", width: "60px", attributes: {style: "text-align:left;"}, headerAttributes: {style: "text-align:left;"}, editor: cbEditor }, { command: [ { name: "edit", text: { edit: " ", update: "Save", cancel: " "} }, { name: "copy", text: " ", iconClass: "k-icon k-i-copy", click: function(e) { e.preventDefault(); var data = this.dataItem(jq(e.target).closest("tr")); field1 = data.field1; field2 = data.field2; field3 = data.field3; field4 = data.field4; field5 = data.field5; field6 = data.field6; copyBool = true; jq("#inline_grid").data("kendoGrid").addRow(); } }, { name: "destroy", text: " ", iconClass: "k-icon k-i-delete" }, ], title: "&nbsp;", width: "60px", attributes: {style: "text-align:right;"} } ], noRecords: true, pageable: { previousNext: false, numeric: false, alwaysVisible: true, pageSizes: [5,10,15] }, editable: { mode: "inline", createAt: "bottom" }, edit: function(e) { var model = e.model, container = e.container, nummer = parseInt(jq("#inline_grid").data("kendoGrid")._data[jq("#inline_grid").data("kendoGrid")._data.length - 2].field1) + 1; jq("#inline_grid tbody").find("tr.k-state-selected").removeClass("k-state-selected k-state-selecting"); /* field1 */if(e.model.isNew() && !e.model.dirty) { e.container .find("input[name=field1]") .val(nummer) .change(); } if(copyBool) { e.model.set("field2", field2); e.model.set("field3", field3); e.model.set("field4", field4); e.model.set("field5", field5); e.model.set("field6", field6); copyBool = false; }

... }, save: function(e) { $("model").value = "test"; $("nr").value = e.model.field1; $("active").value = e.model.field2; $("art").value = e.model.field3; $("description").value = e.model.field4; $("comment").value = e.model.field5; $("processed").value = e.model.field6; ... }, remove: function(e) { $("model").value = "test"; $("nr").value = e.model.field1; ... } }); var inline_grid = jq("#inline_grid").data("kendoGrid"); function textEditor(container,options) { jq('<input data-value-update="input" type="text" class="k-textbox k-valid" id="' + options.field + '" name="' + options.field + '" maxlength="30" autocomplete="off" data-bind="value:' + options.field + '"/>') .appendTo(container); } function cbEditor(container,options) { jq('<input type="checkbox" class="k-checkbox" id="' + options.field + '" name="' + options.field + '" value="yes"/>') .appendTo(container); } function ddlEditor(container,options) { jq('<input id="ddl_' + options.field + '" data-text-field="field1" data-value-field="field1" data-bind="value:' + options.field + '"/>') .appendTo(container) .kendoDropDownList({ dataTextField: "field1", dataValueField: "field1", autoBind: false, dataSource: { transport: { read: { url: "GetJsonData_Grid.p", data: { "function": "testfunction", "element": "ddl", "param1": "testparam1" } }, dataType: "json" }, schema:{ data: "data", total: "recordsCount" }, sort: { field: "field1", dir: "asc" } }, optionLabel: "-- select --", optionLabelTemplate:"<span style='color:gray;'>-- select --</span>", filter: "startswith", filtering: function(e) { var filterValue = e.filter != undefined ? e.filter.value : ""; e.preventDefault(); filtering("#ddl_" + options.field,filterValue,2); }, headerTemplate: "<div> \ <table> \ <tr> \ <td style='font-weight:bold;width:100px;'>Code</td> \ <td style='font-weight:bold;width:200px;'>Description</td> \ </tr> \ </table> \ <div>", template: "<div> \ <table> \ <tr> \ <td style='width:100px;' nowrap>#= field1 #</td> \ <td style='width:200px;' nowrap>#= field2 #</td> \ </tr> \ </table> \ <div>", autoWidth: true, change: function(e) { ddl_value = this.value(); // Tooltip e.sender.select(function (dataItem) { if(dataItem.field1 == ddl_value) { jq("[data-container-for=" + options.field + "] .k-widget.k-dropdown").prop("title", dataItem.field2); return (dataItem.field1 == ddl_value); } }); } }); }; }); // jq(document).ready(function() {

Any idea what might be causing the typeError?

 

Thanks in advance,

Syian

Georgi Denchev
Telerik team
 answered on 21 Sep 2021
1 answer
543 views

Hi Team,

This dojo to illustrate the problem: https://dojo.telerik.com/iNIsiHig

When using jquery 3.6.0, the window does not get focus. Using any previous jquery like 3.5.1 or 1.12.4 makes it work.

Please advise.

 

Best regards,

Laurent.

Martin
Telerik team
 answered on 21 Sep 2021
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?