Telerik Forums
Kendo UI for jQuery Forum
4 answers
633 views

I have a Kendo UI spreadsheet and defined validations to columns. Validations are working when I enter data manually in the sheet. But if I do a Copy paste from Excel, the validations are not working. Any help on this is highly appreciated

            $(function () {
                $("#spreadsheet").kendoSpreadsheet({
                    //                excel: {                
                    //                    // Required to enable saving files in older browsers
                    //                    proxyURL: "//demos.telerik.com/kendo-ui/service/export"
                    //                },   
                    columns: 25,
//                    headerHeight: 0,
//                    headerWidth: 0,
                    toolbar: false,
//                    formulabar: false,
                    sheetsbar: false,
                    sheets: [
                    {
                        rows: [
                            {
                                height: 30,
                                cells: [
                                    {
                                        value: "Column1", background: "rgb(204,204,204)", textAlign: "center", color: "rgb(255,0,0)", bold: "true", fontName: "Arial"
                                    },
                                    {
                                        value: "Column2", background: "rgb(204,204,204)", textAlign: "center", color: "rgb(255,0,0)", bold: "true", fontName: "Arial"
                                    },
                                    {
                                        value: "Column3", background: "rgb(204,204,204)", textAlign: "center", color: "rgb(255,0,0)", bold: "true", fontName: "Arial"
                                    }
                                ]
                            }
                        ],
                        columns: [
                            {
                                width: 80
                            },
                            {
                                width: 115
                            },
                            {
                                width: 115
                            }
                        ]
                        },
                        {
                            name: "ListValues",
                            rows: [ //A2:A1001
                                    {
                                    cells: [
                                                {
                                                    value: 'I'
                                                },
                                                {
                                                    value: 'C'
                                                }
                                            ]
                                    }
                                    ]
                        }
                ]
                    });

                    //Get the column range
                    var range = $("#spreadsheet").data("kendoSpreadsheet").activeSheet().range("A2:A1001");

                    //Apply the validation rule
                    range.validation({
                        dataType: "list",
                        from: "ListValues!A$1:B$1",
                        allowNulls: false,
                        type: "reject",
                        titleTemplate: "Invalid Value",
                        messageTemplate: "Column1 valid values are 'C' and 'I'."
                    });
            });

Marin Bratanov
Top achievements
Rank 1
Iron
 answered on 09 Nov 2017
1 answer
433 views

We have discovered that the Skip and Take parameters that are used for paging, are treated as expression constants inside the Kendo.Mvc librabry.

For this reason, each page will generate a slightly different query because these two numbers are IN the query versus begin a query parameter.

Most DBMS systems who use optimized query plans, will not be able to re-use these plans for different pages, which is a performance waste.

Here are some blogs also describing our issue:

  • https://anthonychu.ca/post/entity-framework-parameterize-skip-take-queries-sql/
  • https://visualstudiomagazine.com/articles/2016/12/06/skip-take-entity-framework-lambda.aspx

I also attached a screenshot of the Skip and Take implementation of the Kendo.Mvc Queryable Extensions library.

Our software is based on .NET 4.6 and we have no near-future plans to going to .NET Core.

Is there a workaround for this performance issue?

Stefan
Telerik team
 answered on 09 Nov 2017
5 answers
317 views
In documentation it writes, that kendo.Observable inherits from kendo.Class. In documentation for Class I read "The base class of most Kendo objects. Provides simple inheritance support".

So with the upper statements this should work:
<div id="main">
    <div data-bind="html: value"></div>
    <div data-bind="html: value2"></div>
</div>
 
<script>
     
    var MVVM1 = kendo.observable(
            {
                value: "bla",
            });
 
    var MVVM2 = MVVM1.extend(
            {
                value2: "bla2",
            });
     
    kendo.bind($('#main'), this.MVVM2);
 
</script>
but it doesn't. 
Is there any way to inherit with MVVM? In my SPA I could share some MVVM and I don't want to duplicate code.
Insad
Top achievements
Rank 2
 answered on 09 Nov 2017
7 answers
1.7K+ views

Is there a limit on the number of rows you can export from the spreadsheet into excel?

Im having trouble with 15,000 rows, 31 columns.

Thanks

Veselin Tsvetanov
Telerik team
 answered on 08 Nov 2017
2 answers
668 views

I have multiselect field in grid with inline editing. When I enter 1st time edit mode, everything displays correct. but when I enter 2nd and more, selected values in multiselect box dissapear, but they are staying selected in dropdown list. How can I fix it?

Code below:

function authorMultiSelectEditor(container, options) {
    indexAuthor = options.model.Id
    $('<select data-bind="value:' + options.field + '"/>')
        .appendTo(container)
        .kendoMultiSelect({
            filter: "startswith",
            suggest: true,
            autoBind: false,
            valuePrimitive: true,
            dataTextField: "Name",
            dataValueField: "Id",
            dataSource: auhors,
            select: onSelectAuthor,
            deselect: onDeselectAuthor
        });
};
    let datasource = new kendo.data.DataSource({
        transport: {
            read: function (e) {
                $.ajax({
                    type: "GET",
                    url: '/Book/Index',
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    success: function (data) {
                        e.success(data);
                    },
                    error: function (data) {
                        e.error("", "400", data);
                    }
                });
            },
 
            update: function (e) {
                var postData = new createUpdatedBook(e.data);
                $.ajax({
                    type: "POST",
                    url: '/Book/Update',
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    data: JSON.stringify(postData),
                    success: function (data) {
                        $('#grid').data('kendoGrid').dataSource.read();
                        $('#grid').data('kendoGrid').refresh();
                    },
                    error: function (data) {
                        $('#grid').data('kendoGrid').dataSource.read();
                        $('#grid').data('kendoGrid').refresh();
                        e.error("", "400", data);
                    }
 
                });
            },
 
            create: function (e) {
                var postData = e.data;
                $.ajax({
                    type: "POST",
                    url: '/Book/Insert',
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    data: JSON.stringify(postData),
                    success: function (data) {
                        e.success(data);
                        $('#grid').data('kendoGrid').dataSource.read();
                        $('#grid').data('kendoGrid').refresh();
                    },
                    error: function (data) {
                        e.error("", "400", data);
                        $('#grid').data('kendoGrid').dataSource.read();
                        $('#grid').data('kendoGrid').refresh();
                    }
 
                });
            },
 
            destroy: function (e) {
                var postData = e.data.Id;
                $.ajax({
                    type: "POST",
                    url: '/Book/Delete/?id=' + postData,
                    contentType: "application/string; charset=utf-8",
                    dataType: "string",
                    data: postData,
                    success: function (data) {
                        e.success(data);
                    },
                    error: function (data) {
                        e.error("", "400", data);
                    }
                });
            }
        },
        batch: false,
        pageSize: 20,
        schema: {
            model: {
                id: "Id",
                fields: {
                    Id: { type: "string", editable: false, },
                    Name: { type: "string", validation: { required: true } },
                    IdPublisher: { type: "string", editable: false },
                    PublisherName: { type: "string", validation: { required: true } },
                    IdAuthor: { type: "string", editable: false },
                    AuthorName: { type: "string", validation: { required: true } },
                }
            }
        },
        change: function (e) {
            if (e.action === "itemchange" && e.field == "PublisherName") {
                var model = e.items[0],
                    currentValue = dataItem.Id;
                if (currentValue !== model.IdPublisher) {
                    model.IdPublisher = currentValue;
                    $("#grid").find("tr[data-uid='" + model.uid + "'] td:eq(3)").text(currentValue);
                }
            }
        },
        requestEnd: onRequestEnd
    });
    
 $("#grid").kendoGrid({
        dataSource: datasource,
        navigatable: true,
        pageable: true,
        height: 550,
        toolbar: ["create", "cancel"],
        columns: [
            { field: "Id", title: "id" },
            { field: "Name", title: "Book Name", width: 400 },
            { field: "Authors", title: "Authors", template: authorMultiTemplate, editor: authorMultiSelectEditor, width: 700 },
            { field: "IdPublisher", title: "IdPublisher" },
            { field: "PublisherName", title: "Publisher", editor: publisherAutoCompleteEditor, width: 300 },
            { command: ["edit", "destroy"], title: " ", width: 300 }],
        toolbar: ["create"],
        editable: "inline",
        dataBound: function (e) {
            this.hideColumn(0);
            this.hideColumn(3);
        }
    });
});

 

Dimitar
Telerik team
 answered on 08 Nov 2017
3 answers
351 views

Hello,

I want to ask, is in spreadsheet can add images on cells?

 

Thanks

Nencho
Telerik team
 answered on 08 Nov 2017
9 answers
563 views

Hi,

I'm currently using your File Uploader widget as part of an edit dialog in a Grid. When uploading I've managed to send a token as part of the header, but I can't get this to work when I'm trying to remove files? I've debugged in to the code and the event-object is missing the "XMLHttpRequest" property. Has this been added in later versions of Kendo(I'm using ) or is there another way I can append said token as part of the header?

My code for the "onUpload" and "onRemove" events are as follows:

01.function onUpload(e) {
02.                            var xhr = e.XMLHttpRequest;
03.                            xhr.addEventListener('readystatechange', function(e) {
04.                                //1 = Opened, append the Authorisation token with the request
05.                                if (xhr.readyState === 1) {
06. 
07.                                    // jscs:disable requireCamelCaseOrUpperCaseIdentifiers
08.                                    xhr.setRequestHeader('Authorization', 'Bearer ' + apiservice.getAccessToken()); //jshint ignore: line
09.                                    // jscs:enable requireCamelCaseOrUpperCaseIdentifiers
10.                                }
11.                            });
12.                        }
13. 
14.                        function onRemove(e) {
15.                            //Send file ids to the server
16.                            //This seems to always contain one file..
17.                            var fileIds = [];
18.                            for (var j = 0; j < e.files.length; j++) {
19.                                fileIds.push(e.files[j].fileid);
20.                            }
21.                            e.data = {fileIds: fileIds};
22.                        }
Plamen
Telerik team
 answered on 08 Nov 2017
2 answers
937 views

Hi.
I have this dropdown

function SomeFilter(element) {

$(element).attr('id', "SOmething");

element.kendoDropDownList(
{
  dataSource: {
    transport: {
      read:
      {
        type: "POST",
        url: "@Url.Action("SomeAction", "SomeController")"
      }
    }
  },
  filter: "contains",
  highlightFirst: true,
  delay: 300,
  optionLabel: "Select Something",
  dataTextField: "dataTextField",
  dataValueField: " dataValueField ",
  select: onSelect,
  dataBound: onDataBound,
  open: onOpen
});
}

that is a filter in my grid

columns.Bound(e => e.SomeValue).Title("SomeTitle").Width(85).Filterable(x => x.UI("SomeFilter").Extra(false));

So far, so good. This all works fine. What I need to need is if there is a way to do the filtering on dataValueField instead of dataTextField.

Rui
Top achievements
Rank 1
 answered on 08 Nov 2017
8 answers
3.6K+ views
i am using kendo grid.
is there any inbuilt API for generate Row Number  Column in kendo Grid.

i tried this way in onGridDataBound Event.

           gridName = gridName == null ? '' : '#' + gridName;
           var dataTable = $(gridName + ' .k-grid-header table');
           var ContentTable = $(gridName + ' .k-grid-content table tr');
           if(dataTable.find('th[role=RowNumber]').length == 0)
           {
              dataTable.first().find('thead tr th:eq(0)').before("<th  width='100px' scope='col' role='RowNumber' >Row Number</th>");
           }
           var hasRowNumber  = ContentTable.first().find('td.rownumber').length == 0 ? true : false;
           ContentTable.each(function(index, row){
                  if(hasRowNumber)
                  {
                    $(row).find('td').first().before("<td title='RowNumber' role='gridcell' class='rownumber' >"+ (index + 1)+"</td>");
                  }
                  else
                  {
                    $(row).find('td.rownumber').html(index + 1);
                  }
          });


but when i change data source client side then it's not working.

please help

Thanks,

Mayank

Dimo
Telerik team
 answered on 08 Nov 2017
1 answer
172 views

I'm working with grids that have a lot of columns.  Using your latest version (2017.3.1026), the 'Columns' menu for any column that is also filterable can no longer be scrolled using a trackpad or scroll wheel.  The dojo example below was copied from the column menu demo: http://demos.telerik.com/kendo-ui/grid/column-menu but more columns were added to demonstrate scrolling.  The undesired behavior can be seen on the first four columns which are filterable.  Beginning with the fifth column, 'Test 2', the 'filterable' property is set to 'false' and scrolling behaves as expected.  This is reproducible in the latest versions of Chrome and Firefox.

 

http://dojo.telerik.com/aQoxa

Stefan
Telerik team
 answered on 08 Nov 2017
Narrow your results
Selected tags
Tags
Grid
General Discussions
Charts
Data Source
Scheduler
DropDownList
TreeView
MVVM
Editor
Window
DatePicker
Spreadsheet
Upload
ListView (Mobile)
ComboBox
TabStrip
MultiSelect
AutoComplete
ListView
Menu
Templates
Gantt
Validation
TreeList
Diagram
NumericTextBox
Splitter
PanelBar
Application
Map
Drag and Drop
ToolTip
Calendar
PivotGrid
ScrollView (Mobile)
Toolbar
TabStrip (Mobile)
Slider
Button (Mobile)
Filter
SPA
Drawing API
Drawer (Mobile)
Globalization
LinearGauge
Sortable
ModalView
Hierarchical Data Source
Button
FileManager
MaskedTextBox
View
Form
NavBar
Notification
Switch (Mobile)
SplitView
ListBox
DropDownTree
PDFViewer
Sparkline
ActionSheet
TileLayout
PopOver (Mobile)
TreeMap
ButtonGroup
ColorPicker
Pager
Styling
Chat
MultiColumnComboBox
Dialog
DateRangePicker
Checkbox
Timeline
Drawer
DateInput
ProgressBar
MediaPlayer
ImageEditor
TextBox
OrgChart
Accessibility
Effects
PivotGridV2
Licensing
ScrollView
Switch
TextArea
BulletChart
QRCode
ResponsivePanel
Wizard
CheckBoxGroup
Localization
Barcode
Breadcrumb
Collapsible
MultiViewCalendar
Touch
RadioButton
Stepper
Card
ExpansionPanel
Rating
RadioGroup
Badge
Captcha
Heatmap
AppBar
Loader
Security
TaskBoard
Popover
DockManager
TimePicker
FloatingActionButton
CircularGauge
ColorGradient
ColorPalette
DropDownButton
TimeDurationPicker
ToggleButton
BottomNavigation
Ripple
SkeletonContainer
Avatar
Circular ProgressBar
FlatColorPicker
SplitButton
Signature
Chip
ChipList
VS Code Extension
AIPrompt
PropertyGrid
Sankey
Chart Wizard
OTP Input
SpeechToTextButton
InlineAIPrompt
StockChart
ContextMenu
DateTimePicker
RadialGauge
ArcGauge
AICodingAssistant
SmartPasteButton
PromptBox
SegmentedControl
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?