Telerik Forums
Kendo UI for jQuery Forum
1 answer
218 views

 In the following example I want to sort the inner lists and not the other list. In my live example the lists are generated by the grouped list functionality, so I can't give each list an id and create a separate sortable object. How do I create a sortable set of inner lists using kendo native listview grouping? 

 

<!DOCTYPE html>
<html>
<head>
<meta name="description" content="Unable to sort inner list in kendo nested list">
    <style>html { font-size: 14px; font-family: Arial, Helvetica, sans-serif; }</style>
    <title></title>
    <link rel="stylesheet" href="//kendo.cdn.telerik.com/2016.1.226/styles/kendo.common-material.min.css" />
    <link rel="stylesheet" href="//kendo.cdn.telerik.com/2016.1.226/styles/kendo.material.min.css" />
 
    <script src="//kendo.cdn.telerik.com/2016.1.226/js/jquery.min.js"></script>
    <script src="//kendo.cdn.telerik.com/2016.1.226/js/angular.min.js"></script>
    <script src="//kendo.cdn.telerik.com/2016.1.226/js/kendo.all.min.js"></script>
</head>
<body>
<div id="example" ng-app="KendoDemos">
    <div ng-controller="MyCtrl">
  <ul class="playlist" kendo-sortable k-placeholder="placeholder" k-hint="hint">
    <li>Happy
      <ul>
    <li>Papercut <span>3:04</span></li>
    <li>One Step Closer <span>2:35</span></li>
    <li>With You <span>3:23</span></li>
    <li>Points of Authority <span>3:20</span></li>
    <li>Crawling <span>3:29</span></li>
    </ul>
    </li>
    <li>Sad
   <ul>
      <li>Runaway <span>3:03</span></li>
    <li>By Myself <span>3:09</span></li>
    <li>In the End <span>3:36</span></li>
    <li>A Place for My Head <span>3:04</span></li>
    <li>Forgotten <span>3:14</span></li>
    <li>Cure for the Itch <span>2:37</span></li>
    <li>Pushing Me Away <span>3:11</span></li>
    </ul>
    </li>
  </ul>
</div>
<style>
    .playlist {
        margin: 30px auto;
        padding: 10px;
        width: 300px;
        background-color: #f3f5f7;
        border-radius: 4px;
        border: 1px solid rgba(0,0,0,.1);
    }
    .playlist li {
        list-style-type: none;
        position: relative;
        padding: 6px 8px;
        margin: 0;
        color: #666;
        font-size: 1.2em;
        cursor: move;
    }
    .playlist li:hover {
        background-color: #dceffd;
    }
    .playlist li span {
        position: absolute;
        right: 5px;
    }
    li.hint {
        display: block;
        padding: 10px;
        width: 200px;
        background-color: #52aef7;
        color: #fff;
    }
 
    li.hint:last-child {
        border-radius: 4px;
    }
 
    li.hint span {
        color: #fff;
    }
 
    li.placeholder {
        background-color: #dceffd;
        color: #52aef7;
        text-align: right;
    }
</style>
</div>
 
<script>
    angular.module("KendoDemos", [ "kendo.directives" ])
        .controller("MyCtrl", function($scope){
            $scope.placeholder = function(element) {
                return element.clone().addClass("placeholder").text("drop here");
            };
            $scope.hint = function(element) {
                return element.clone().addClass("hint");
            };
        })
</script>
 
 
</body>
</html>

In the following example I want to sort the inner lists and not the other list. In my live example the lists are generated by the grouped list functionality, so I can't give each list an id and create a separate sortable object. How do I create a sortable set of inner lists using kendo native listview grouping?

In the following example I want to sort the inner lists and not the other list. In my live example the lists are generated by the grouped list functionality, so I can't give each list an id and create a separate sortable object. How do I create a sortable set of inner lists using kendo native listview grouping?

In the following example I want to sort the inner lists and not the other list. In my live example the lists are generated by the grouped list functionality, so I can't give each list an id and create a separate sortable object. How do I create a sortable set of inner lists using kendo native listview grouping?

Alexander Popov
Telerik team
 answered on 06 Apr 2016
1 answer
102 views
I'm trying to modify the Time dropdown to show Midnight and Noon instead of 12:00 AM and 12:00 PM.  I can do it easily enough with jquery and the Open event but my problem is when you select one of them, the field is blanked out because it doesn't fit the correct format.  Is there anyway I can modify the value just before the default click event is executed?
Georgi Krustev
Telerik team
 answered on 06 Apr 2016
1 answer
63 views

Hello,

With numbers of 10 digits and more, I have a formatting issue even using kendo.toString() in jquery or DisplayFormat through field decoration on Class ViewModel.

For exemple, 2 458 200 256 using kendo.toString(number, "#,###.###;(- #,###.###);0") will return 24 582 00256 which is totally wrong.

Before upgrade everthing was working correctly. If I want to correctly format number, I need to use kendo.toString(number, "#,###,###,###.###;(- #,###,###,###.###);0");

Georgi Krustev
Telerik team
 answered on 06 Apr 2016
1 answer
415 views

Is it possible to have columns in the grid view of the Gantt control that are hidden? I have tried setting column widths to 0 which the control seems to ignore ... I see no API call to do it, so does that mean if I want to do that I have to go in and hide the column myself during the onDataBinding or onDataBound events?

The reason I ask is that I want two types of columns:

1) The first is a column in the first index position with unbound checkboxes so I can "select" multiple tasks at once.

2) The second is a set of columns that only become visible if the user presses a button elsewhere on the page.

 

Dimitar Terziev
Telerik team
 answered on 06 Apr 2016
1 answer
788 views

Hi,

I have a simple grid with a custom editor template containing a form. I am using data annotations on the model for validation. However, I am trying to customize the validation (disable tooltips and enable css red border). I can do this by adding styles and hiding the validation fields.

What I cannot do is get the red border to surround date pickers and drop downs. I understand there is a hidden field in there that will hold the value and this is the field that gets validated and that it is the wrapper span that needs to get updated with the css.

I am trying to implement the following:

$("form").kendoValidator({

            errorTemplate: "",  
            validate: function (e) {
                var dropDowns = $(".k-dropdown");

                $.each(dropDowns, function (key, value) {
                    var input = $(value).find("input.k-invalid");  
                    var span = $(this).find("span.k-dropdown-wrap");
               if (input.size() > 0) {
                        $(span).addClass("dropdown-validation-error");
                    } else {
                        $(span).removeClass("dropdown-validation-error");
                    }
                });
            }
       });

I am putting the above code into the document.ready function on the grid page (not the editor template) but the custom validation isn't running on the form in the editor template. Is this form in the editor template reachable at the grid view document.load stage or am I missing something? 

To be honest this behaviour should be available out of the box and I've lost alot of time on it. 

Any suggestions would be appreciated.

Regards

John
Top achievements
Rank 1
 answered on 05 Apr 2016
1 answer
276 views

I can't get kendo listview to properly auto scroll when I have grouping. Change autoscroll to true to see issue below.
I am also having a similar problem with angular.
JSFiddle below
https://jsfiddle.net/jcbowyer/ao0xzoaz/1/

 

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8"/>
        <title>Kendo UI Snippet</title>
        <link rel="stylesheet" href="http://kendo.cdn.telerik.com/2016.1.226/styles/kendo.common.min.css"/>
        <link rel="stylesheet" href="http://kendo.cdn.telerik.com/2016.1.226/styles/kendo.rtl.min.css"/>
        <link rel="stylesheet" href="http://kendo.cdn.telerik.com/2016.1.226/styles/kendo.silver.min.css"/>
        <link rel="stylesheet" href="http://kendo.cdn.telerik.com/2016.1.226/styles/kendo.mobile.all.min.css"/>
        <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
        <script src="http://kendo.cdn.telerik.com/2016.1.226/js/kendo.all.min.js"></script>
    </head>
    <body>
        <div data-role="view">
            <ul data-role="listview" data-source="groupedData" data-template="my-template" data-header-template="header-template" data-endless-scroll="false"></ul>
        </div>
        <script type="text/x-kendo-template" id="my-template">
            <h3 class="item-title">#: name #</h3>
             <p class="item-info">#: description #</p>
 
        </script>
        <script type="text/x-kendo-template" id="header-template">
            my group - #: value #
 
        </script>
        <script>
            var groupedData = new kendo.data.DataSource({
               schema : {total: function (data) {
                 return 5}
             },
              data: [
                { name: "Sashimi Salad", description: "Organic greens topped with market fresh sashimi, wasabi soy vinaigrette.",  letter: "S" },
                { name: "Seaweed Salad", description: "A nice seaweed salad.",  letter: "S" },
            { name: "Edamame", description: "Boiled soy beans with salt.",  letter: "E" },
            { name: "Maguro", description: "Tuna pieces.",  letter: "M" },
            { name: "Tekka Maki", description: "Tuna roll with wasabi.",  letter: "T" },
            { name: "California Rolls", description: "Crab sticks, avocado and cucumber.",  letter: "C" }
              ],
              group: { field: "letter" },
            pageSize: 2
            });
 
            new kendo.mobile.Application();
 
        </script>
    </body>
</html>

I can't get kendo listview to properly auto scroll when I have grouping. Change autoscroll to true to see issue below.

I am also having a similar problem with angular.

JSFiddle below

https://jsfiddle.net/jcbowyer/ao0xzoaz/1/

I can't get kendo listview to properly auto scroll when I have grouping. Change autoscroll to true to see issue below.

I am also having a similar problem with angular.

JSFiddle below

https://jsfiddle.net/jcbowyer/ao0xzoaz/1/

I can't get kendo listview to properly auto scroll when I have grouping. Change autoscroll to true to see issue below.

I am also having a similar problem with angular.

JSFiddle below

https://jsfiddle.net/jcbowyer/ao0xzoaz/1/

Dimiter Topalov
Telerik team
 answered on 05 Apr 2016
1 answer
2.1K+ views

I am creating my own filters on filter initialization and i need to do some logics and adding values in my filter inputs every time the user click on the filter, but the issue is that filterMenuInit is being fired only once. i was wondering how i can raise this event again, or is there any other event which is being raised on the clicking on the filter?

var initializedFilterMenu = function (e) {
//my logic
};
 
var gridOptions = {
  dataSource: dataSource,
  columns: gridColumns,
  editable: gridEditable,
  pageable: {
    refresh: true, //if set to true, it will show refresh button,clicking on that will make the grid to refresh
    numeric: false,
    previousNext: false,
    messages: {
      display: "Loaded {0}-{1} from {2} data items"
    },
  },
  height: gridHeight,
  scrollable: {
    virtual: true,
  },
  groupable: gridGroupable,
  filterable: gridFilterable,
  sortable: {
    mode: "multiple"
  },
   
  filterMenuInit: initializedFilterMenu,  // The initializedFilterMenu event is raised when the filter menu is initialized.
};
 
var grid = Ember.$("#kendo-grid").kendoGrid(gridOptions).data('kendoGrid');
_this.set('kendoGrid', grid);

Maria Ilieva
Telerik team
 answered on 05 Apr 2016
2 answers
409 views

Hi I have one requirement in Kendo  UI Grid pagination.

How to show

X items / rows in 1st page

X+1 items / rows in 2nd page

X+2 items / rows in 3rd page

I have tried bellow code but not worked, it will show 2 items per page because of latest query selection.

$("div[kendo-grid]").data().kendoGrid.dataSource.query({pageSize: 3, page:1});

$("div[kendo-grid]").data().kendoGrid.dataSource.query({pageSize: 4, page:2});

$("div[kendo-grid]").data().kendoGrid.dataSource.query({pageSize: 2, page:3});

 

Dimiter Topalov
Telerik team
 answered on 05 Apr 2016
3 answers
252 views

Hello,

I am trying to implement a dynamic tabstrip. Below is the code snippets after which I will try to explain the problem I am facing.

HTML:

<div class="text-module">
    <div k-animation="false" class="basic"
         k-options="vm.tabOptions"
         k-data-source="vm.tabsToDisplay"
         k-data-content-url-field="'contentUrl'"
         k-data-text-field="'title'"
         ng-model="vm.tabToSelect">
    </div>
</div>

Data source collection:

vm.tabsToDisplay = new kendo.data.DataSource();
vm.tabItemsSource = [
    {
        id: 1,
        title: 'Title1',
        contentUrl: '/App/Modules/MyModule/Views/a.html',
        Type: 'X',
    },
          {
        id: 2,
        title: 'Title2',
        contentUrl: '/App/Modules/MyModule/Views/b.html',
        Type: 'Y',
    },
];

Method to change tab source based on let's say a button click (toggle)

            function filterTabsToDisplay() {
//vm.ToggleOption could be either X or Y
                vm.filteredTabs = _.filter(vm.tabItemsSource, function (tab) { return tab.Type === vm.ToggleOption; });
                vm.tabsToDisplay.data(vm.filteredTabs);
            }

Tab options:

//Below stuff can be removed; exists for logging purpose only
vm.tabOptions = {
    select: function (e) {
        console.log("Selected: " + e.item.innerText);
    },
    activate: function (e) {
        console.log("Activated: " + e.item.innerText);
    },
    show: function (e) {
        console.log("Shown: " + e.item.innerText);
    },
    contentLoad: function (e) {
        console.log("Content loaded in " + e.item.innerText);
    },
    error: function (e) {
        console.log("Loading failed with " + e.xhr.statusText + " " + e.xhr.status);
    }
};

Tab selection:

function selectTab(tabToSelectId) {
    vm.tabToSelect = _.filter(vm.filteredTabs, function (tab) { return tab.id === tabToSelectId; })[0].title;
}

 

By default value of "vm.ToggleOption" is X which means 1 tab is shown to user. If I see the network tab when this happens, I see that "a.html" gets loaded dynamically. This page is an html page with angular controller attached. So the controller gets initialized as well. If I toggle to Y, "b.html" is loaded and its controller initialized. Everything is good so far.

Now, If I toggle back to X, "a.html" gets loaded again (I see this in network tab) which means the controller associated with this html gets initialized again. This is a problem because when the second load of "a.html" happens, the controller created during previous load already exists and hence I now have two instances of same controller which for me is a problem. If I continue to switch the toggle, every time, a new controller gets created which is quite problematic.

My question is, is this expected behavior when I use "k-data-content-url-field" option. Is there any way I can control this behavior so that it doesn't load the associated html every time?

Also, I have observed that this happens only when I change the bounded data source in some way (using filterTabsToDisplay method). If I have static tab strip like below, this problem doesn't arise.

    <div class="text-module" ng-if="vm.ToggleOption=='X'">
        <div kendo-tab-strip k-animation="false" id="tabstrip1" class="basic">
            <ul>
                <li class="k-state-active">
                    <span>Title1</span>
                </li>
            </ul>
            <div>
                <div ng-include="'/App/Modules/MyModule/Views/a.html'"></div>
            </div>
             
    <div class="text-module" ng-if="vm.ToggleOption=='Y'">
        <div kendo-tab-strip k-animation="false" id="tabstrip2" class="basic">
            <ul>
                <li class="k-state-active">
                    <span>Title2</span>
                </li>                           
            </ul>
            <div>
                <div ng-include="'/App/Modules/MyModule/Views/b.html'"></div>
            </div>
        </div>
    </div>
</div>

Regards,

Vinod

Petyo
Telerik team
 answered on 05 Apr 2016
5 answers
1.6K+ views

Hi

I often set some default values or values from the database in my form widgets. Now this works very well but if I clear the form beforehand using

$('#myform')[0].reset();

the widgets don't seem to accept the values anymore, e.g. myKendoDropDown.select(1) stopps working. This is true for other widgets as well.

What am I missing here ?

Kind regards

Alex

Alex
Top achievements
Rank 1
Iron
 answered on 05 Apr 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
ScrollView
Switch
TextArea
BulletChart
Licensing
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
FloatingActionButton
CircularGauge
ColorGradient
ColorPalette
DropDownButton
TimeDurationPicker
ToggleButton
TimePicker
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
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?