Telerik Forums
Kendo UI for jQuery Forum
0 answers
178 views

Auto complete for Document type works as expected when i add new file (Tool bar add file).
How do I achieve the same auto complete and validation if user clicks edit/Update? I am using ScaffoldColumn to make the Doc type editable when user clicks Edit in Kendo Grid??

 @(Html.Kendo().Grid<FileDataModel>()
                  .Name("grid")
                  .Columns(columns =>
                  {
                  columns.Bound(c => c.FileName);
                  columns.Bound(c => c.Title);
                  columns.Bound(c => c.SelectedDocType);
                  columns.Template(@<text></text>).Title("<b>Download</b>")
                          .ClientTemplate("<a href='" + Url.Action("Download", "Home", new { @id = "#=Id#" }) + "'>Download</a>")
                          .HtmlAttributes(new { style = "text-align: left;" });
                      columns.Command(command =>
                      {
                          command.Edit();
                          command.Destroy();
                      }).Title("<b>Action</b>");
                  }).Events(e => e.DataBound("onDataBound"))
                  .Scrollable(a=>a.Height("auto"))
                  .Selectable()
                  .Groupable()
                  .Sortable()
                  .Editable(config => config.Mode(GridEditMode.PopUp))
                  .Pageable(pageable => pageable
                      .Refresh(true)
                      .PageSizes(true)
                      .ButtonCount(5))
                  .ToolBar(toolBar => toolBar.Template("<a class='k-button  k-button-icontext' onclick='addFilePopup()' href='#' id='addNewFile'></span>Add new file</a>"))
                  .DataSource(dataSource => dataSource
                      .Ajax()
                      .Batch(false)
                      .PageSize(20)
                  .Model(model =>
                  {
                      model.Id(p => p.Id);
                      model.Field(p => p.Id).Editable(false);
                      model.Field(p => p.CreatedDate).Editable(false);
                      model.Field(p => p.DateSigned).Editable(false);
                      model.Field(p => p.DateSubmitted).Editable(false);
                      model.Field(p => p.DjjNumber).Editable(false);
                      model.Field(p => p.ScanDate).Editable(false);
                      model.Field(p => p.ScanUser).Editable(false);
                  })
                  .Read(read => read.Action("GetFiles", "Home", new { djjNumber = Model.DjjNumber }))
                  .Update(update => update.Action("EditingInline_Update", "Home"))
                  .Destroy(destroy => destroy.Action("EditingInline_Destroy", "Home"))
          ))

</div>


Kendo Autocomplete and Validation function.
$("#txtDocType").kendoAutoComplete({
            dataSource: new kendo.data.DataSource({
                type: "json", // specifies data protocol
                pageSize: 3,//This is to set search limit
                serverFiltering: true,
                transport: {
                    read: '@Url.Action("GetDocumentTypes", "Home")',
                    parameterMap:function(){
                        return {filterKey:$("#txtDocType").data("kendoAutoComplete").value()};
                    }
                },
            }),
            dataTextField:"Type",
            filter: "contains",
            minLength: 3,//This is to set minimum character length for autocomplete
        });
    });

    function ValidateDocumentType(){
        var isValidDocType=true;
        $.ajax({
            data:{documentType:$("#txtDocType").val()},
            url:'@Url.Action("GetDocumentType", "Home")',
            async: false,
            success:function(data) {
                if(data==false)
                    isValidDocType=false;
                complete=true;
            },
        });
        return isValidDocType;
    }

Sai
Top achievements
Rank 1
 asked on 07 Oct 2016
2 answers
513 views

I have a Kendo ListView, which I have selected set to "multiple". I also have a button on that page that will do data processing. Part of it's function is to get the selected items from that ListView and put them into some type of array. However I can't even accessthe bloody selected items from the ListView.

With Telerik's PATHETIC support for Angular I have to resort to jQuery, but even with that older code I still can't get a list of selected items from the ListView.

Obligatory code sections that proably won't make sense to anybody, but need to be included otherwise support will whine about not having code to review.

HTML:

<fieldset class="bsFilterSetGreyBk bsFullHeight">
   <legend class="bsLegend">Available To Assign</legend>
   <div kendo-listview id="unAssignedListView" k-data-source="camu.mUnassigned" k-options="camu.klvOptions"></div>
   <div kendo-pager id="unAssignedPager" k-data-source="camu.mUnassigned"></div>
</fieldset>

Angular Controller:

(function() {
    "use strict";
    angular
        .module("controller.assignUser", ["ngAnimate", "ngMessages", "ngSanitize", "kendo.directives"])
        .controller("ctrlAssignUser",
        [
            "$window",
            "appSettings",
            "assignToUser",
            function ($window, appSettings, assignToUser) {
                var camu = this;
                camu.lstSelection = null;
                camu.selId = null;
                camu.auOptions = {
                    optionLabel: "Click Here to choose user...",
                    dataTextField: "user",
                    dataValueField: "id",
                    dataSource: {
                        transport: {
                            type: "jsonp",
                            read: {
                                url: appSettings.serverPath + "/api/assign/allusers/"
                            }
                        }
                    }
                };
                
                camu.klvOptions = {
                    selectable: "multiple",
                    template: "<div class='klvItems'>#= oldMeterNumber#</div>"
                }
                camu.addMtr = function() {
                    var list = $("#unAssignedListView").data("kendoListView");
//Resorting to jQueary because of... reasons! List is test variable that I can't get the selected data into.
                };
                camu.changeAssUser = function () {
                    if (camu.selId === "") {
                        camu.selId = null;
                        return;
                    }
                    camu.mUnassigned = new kendo.data.DataSource({
                        transport: {
                            type: "jsonp",
                            read: function(options) {
                                assignToUser.getUnassigned.query(
                                    null,
                                    function(data) {
                                        options.success(data);
                                    });
                            }
                        },
                        pageSize: camu.getListViewRows()
                    });
                    camu.mAssignUser = new kendo.data.DataSource({
                        transport: {
                            type: "jsonp",
                            read: function (options) {
                                assignToUser.getAssigned.query(
                                    { "userId": camu.selId },
                                    function(data) {
                                        options.success(data);
                                    });
                            }
                        },
                        pageSize: camu.getListViewRows()
                    });
                }
                camu.getListViewRows = function () {
                    return Math.floor(($window.innerHeight - appSettings.windowChrome) / appSettings.rowHeightPx);
                };
                camu.getPageHeight = function () {
                    return { height: ($window.innerHeight - appSettings.navbarHeight) + "px" };
                };
            }
        ]);
}());

So what am I doing wrong?

Clint
Top achievements
Rank 1
Iron
Iron
Iron
 answered on 07 Oct 2016
3 answers
184 views
Is it possible to translate "all" in the Paging Dropdown of newest Kendo Grid version?
Rumen
Telerik team
 answered on 07 Oct 2016
3 answers
239 views

Hi Kendo UI Team,

I was wondering why the Gantt control does not display German translations (e.g. view names) and the solution seems to be that there no german translations for it. The file kendo.messages.de-DE.js does not contain any at least.

Or am I missing something?

 

Rumen
Telerik team
 answered on 07 Oct 2016
1 answer
144 views

Hi!

 

Using http://demos.telerik.com/kendo-ui/grid/angular

When we do any add/edit rows in the Grid the data gets submitted at the backend asynchronously.  We have the save operation to be performed at the form level not at individual section level.How can I keep data from getting saves at Grid Level?

 

Thanks

Dimiter Topalov
Telerik team
 answered on 07 Oct 2016
3 answers
513 views
I have a Model object that needs converted to a JSON object for passing to a WebAPI and when I call the .toJSON method a valid JSON object is returned, but Dates are still in a Date format, which they are not being properly serialized to JSON. So I have for the meantime added a prototype method to the ObservableObject called toJSON2 that checks if the field being processed is a Date object to call the Date objects toJSON method which is a prototype method you guys created anyways. It would be nice though if this one condition to check if the field being processed is a Date to then convert to a JSON date could be added into your source code.

kendo.data.ObservableObject.prototype.toJSON2 = function () {
    var result = {}, value, field;
 
    for (field in this) {
        if (this.shouldSerialize(field)) {
            value = this[field];
 
            if (value instanceof kendo.data.ObservableObject || value instanceof kendo.data.ObservableArray) {
                value = value.toJSON2();
            }
            else if (value instanceof Date) {
                value = value.toJSON();
            }
 
            result[field] = value;
        }
    }
     
    return result;
}


Dimiter Topalov
Telerik team
 answered on 07 Oct 2016
3 answers
801 views

I have a problem with select all options for filtered value. 

First, I cascade from dropdown 

 

function KendoPartnerDropdown(selector, data, textVal, value){
    $(selector).kendoDropDownList({
            dataTextField: textVal,
            dataValueField: value,
            dataSource: data,
            change:filterMultiSelect
    });
    
  
}

function filterMultiSelect(){
    var PartnerDropdown = $("#partner").data("kendoDropDownList");
    var multiSelectBox = $("#portfoliosMultiSelect").data("kendoMultiSelect");
    var partnerIndex = PartnerDropdown.dataItem().PartnerIndex;
    var filters = buildMultiselectFilters(partnerIndex);

    if(filters.length === 0){
        multiSelectBox.dataSource.filter({});
        multiSelectBox.value(getMultiselectValues(filteredDataValues(multiSelectBox.dataSource.data())));
      
    }else{
        multiSelectBox.tagList.empty();
        multiSelectBox.dataSource.filter(filters);
        // view() shows filtered data for multiselect. 
        var filterdata = multiSelectBox.dataSource.view();
        //setting default value (depending on filtering)
        multiSelectBox.value(getMultiselectValues(filteredDataValues(filterdata)));
    }

 updateMultiSelectCheckAllElementState();
}

    
function buildMultiselectFilters(partnerIndex) {
    var filters = [];
        if (partnerIndex !== 0){
            filters.push({ field: "PartnerIndex", operator: "eq", value: partnerIndex });
        }
        if (!$("#showClosedCheckbox").is(":checked")){
            filters.push({field:"CloseDate", operator: "neq", value: null});
        }
    return filters;
}

and then in multiselect is shown only corresponding filtered values.

 

Multiselect looks like this:

 function kendoPortfolioMultiSelect(selector, data, textVal, value) {

     $(selector).kendoMultiSelect({
         dataTextField: textVal,
         dataValueField: value,
         placeholder: "Select portfolio/s",
         dataSource: data,
         headerTemplate: '<div class="dropdown-header k-widget k-header">' +
                                '<span>ALL</span>' +
                                '<span> <input type="checkbox" id="checkAll" checked onclick="toggleCheckAllState()"></span>' +
                         '</div>',
         itemTemplate: '#:data.Number#<input type="checkbox" onclick = "multiselectItemClick(#:data.Index#)" class="multiSelectPortfolios" checked/></span>',
         tagTemplate: ` # if (values.length < 2) { #
                             # for (var idx = 0; idx < values.length; idx++) { #
                                  #:data.dataItems[idx].Number#
                              # } #
                         # } else { #
                               #:values.length# out of #:maxTotal#
                    # } # `,
         tagMode:"single",
         autoClose: false,
         change: onMultiselectPortfoliosChange,
         select: onSelect,
         value: getMultiselectValues(data)
     });
      toggleCheckAllState();
      showClosedClicked();

 }

function onMultiselectPortfoliosChange(){
      updateMultiSelectCheckAllElementState();
      var currData = $("#currency").data("kendoDropDownList");
      currData.value($("#portfoliosMultiSelect").data("kendoMultiSelect").value().RefCurrency);
 }

function onSelect(e){
   var input = e.item.children("input");
   input.prop("checked", !e.item.hasClass("k-state-selected"));
   updateMultiSelectCheckAllElementState();
}

function filteredDataValues(data){
    var filteredDataPortf = []; 
        data.forEach(f=>{
            filteredDataPortf.push({CloseDate:f.CloseDate, Index:f.Index, Language:f.Language, Number: f.Number, PartnerIndex:f.PartnerIndex, RefCurrency:f.RefCurrency});
    }) 
    return filteredDataPortf;
}


function onMultiselectPortfoliosChange(){
      updateMultiSelectCheckAllElementState();
      var currData = $("#currency").data("kendoDropDownList");
      currData.value($("#portfoliosMultiSelect").data("kendoMultiSelect").value().RefCurrency);
 }

 

function toggleCheckAllState(){
    var multiSelect = $("#portfoliosMultiSelect").data("kendoMultiSelect"); 

    if ( $("#checkAll").is( ":checked" ) ){
        var filterdata = multiSelect.dataSource.view();
        var newValues = getMultiselectValues(filteredDataValues(filterdata)); 
         multiSelect.value(newValues);
   
         $('.multiSelectPortfolios').prop("checked", true);
          
    }else{
        multiSelect.value(getMultiselectValues(filteredDataValues([])));
        $('.multiSelectPortfolios').prop("checked", false);
    }
   
   multiSelect.trigger("change"); 
 }
 
 function multiselectItemClick(data) {
   var multi = $("#portfoliosMultiSelect").data("kendoMultiSelect");
    
    if($('.multiSelectPortfolios:checked').length === $('.multiSelectPortfolios').length){
        $('#checkAll').prop('checked',true);
        multi.value().splice(multi.value().length,0,data);
    }else{
        $('#checkAll').prop('checked',false);
        var removeIndex = multi.value().indexOf(data);
        multi.value().splice(removeIndex, 1);
    }
 }
 
 function showClosedClicked() {
    $('#checkAll').prop('checked',true);
    filterMultiSelect();    
 }
 
 function  getMultiselectValues(data){
       var values = new Array();
      if (data[0] != null) {
            for (var i = 0; i < data.length; i++) {
                if (data[i] == null)
                    break;
                values[i]=data[i].Index;
            }
        }
        return values;
   }

//----checking checkboxis (if it's checked)------/
function updateMultiSelectCheckAllElementState() {
   var multiSelect = $("#portfoliosMultiSelect").data("kendoMultiSelect"); 
  
   var items = multiSelect.ul.find("li");
    $("#checkAll").prop('checked',true);
   items.each(function () {
        var element = $(this);
        var input = element.children("input");
        if (!input.prop("checked")){
            $("#checkAll").prop('checked',false);
        }
   });
 
}

function toggleCheckAllState() select/deselect all item.

The things that I want:

1. when I cascade from dropdown list and get filtetred value, I want that filtered value/s is mark as selected (and ALL checkbox)

2. When I uncheck ALL from filtered multiselect and check ALL again I want that all FILTERED values are selected (this part throws me an error: Cannot read property 'Index' of undefined)

 

Thanks!

 

 

 

 

Georgi Krustev
Telerik team
 answered on 07 Oct 2016
2 answers
86 views
I have a kendo ui grid with custom button which adds a new row.
In that, I want to disable 2nd column when 1st row is inserted.
From 2nd row on wards, I want that column to be enabled.
I Also want to insert count in 1st column on every insert in the grid.
For example: If the first row is inserted, I want 1st column to be "Tier 1".
If 2nd row is inserted, then I want 1st column of 2nd row to be as "Tier 2".
If out of 3, 2nd row is deleted... I want the 3rd row 1st column to be converted from "Tier 3" to "Tier 2".
Can someone please help me achieve this?
I am struggling to have this much of control in kendo grid.
Alexander Popov
Telerik team
 answered on 07 Oct 2016
1 answer
766 views

How can I properly add element to grids pager? I want to add some additional label, buttons ...

I tried with:

this.grid.wrapper.find('.k-pager-wrap.k-grid-pager').prepend("<div>test</div>")

and it works, but problem is, that every time setOptions is called, pager is destroyed and recreated. So I detach my div before calling setOptions and after that prepend it again:

this.footer.detach();
this.grid.setOptions(gridOptions);
this.getKendoPagerWrapper().prepend(this.footer);

but the problem is that also resize destroy pager (I have grid in PageControl in Window). When user resize/maximize/restore/minimize window grid.resize is called which destroy pager and all events, on custom element (this.footer) added to grids pager, are gone.

Rosen
Telerik team
 answered on 07 Oct 2016
3 answers
591 views
I have a window that doesn't have its height set, so its height is dynamic based on the window content. Adding .center() doesn't center the window. How do I center the popup when the height isn't set?
Ianko
Telerik team
 answered on 07 Oct 2016
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?