Telerik Forums
Kendo UI for jQuery Forum
1 answer
307 views

I am using the kendo timepicker and its working wonderfully

 

@(Html.Kendo().TimePicker()
                         .Name("EndTime")
                         .Value(@Model.EndTime)
                         .HtmlAttributes(new { style = "width: 100%", id = "EndTime", name = "EndTime", autocomplete = "off" })
                       )

 

The problem I'm running into is users who want to type values aren't including the AM/PM nor following the correct format.  How can I apply a mask to the timepicker so that they are forced to format properly?

Eduardo Serra
Telerik team
 answered on 25 Jan 2017
4 answers
164 views

Hello!

I am using Kendo MVC UI. I have a Kendo Window that I do a refresh with a passed in url that obtains a MVC partial view which contains a Kendo ListView. This ListView, I do a DataSource read. I created a javascript function to call after the data is received to use the items returned. I tried using the RequestEnd/Change event to call it. It calls the function but the ListView does not appear to be done as the Loading icon is visible still and I don't have access to the dataItems. I am using version 2015.2.805.

How can I access the dataItems right after the request is made to get them?

Thanks!

Craig
Top achievements
Rank 1
 answered on 25 Jan 2017
1 answer
433 views

Hi,

The column resizes to fit to content on double clicking the separator.

Is there any way to keep the column resizable but disable the autofit on double click?

Thanks.
Stefan
Telerik team
 answered on 25 Jan 2017
3 answers
136 views

Attached are the two simple files that demonstrate the problem. I'm trying to load a simple JSON file and then update the data through the model. The trouble is, while the field value is changing in the model, the screen never gets updated unless I change the root of the tree. Any assistance is appreciated.

<!DOCTYPE html>
<head>
<title>MVVM Demo 2</title>
    <link href="/styles/kendo.common.min.css" rel="stylesheet">
    <link href="/styles/kendo.rtl.min.css" rel="stylesheet">
    <link href="/styles/kendo.default.min.css" rel="stylesheet">
    <link href="/styles/kendo.default.mobile.min.css" rel="stylesheet">
    <script src="/js/jquery.min.js"></script>
    <script src="/js/jszip.min.js"></script>
    <script src="/js/kendo.all.min.js"></script>
<style type="text/css">
th {
width: 135px;
        }
</style>
</head>
<body>
<script>
 
var elementMapping = new Map();
 
</script>
     
 
    <div id="example"
        data-role="treeview"
        data-bind="source: root"
        data-text-field="_name">
            
 
 
    </div>
<button type="button" data-bind="click: updateSomething" >Update</button>
 
 
         
<script>
var inputJSON="";
 
const flatten = arr => arr.reduce((a, b) => a.concat(Array.isArray(b) ? flatten(b) : b), []);
 
$.ajax({
    url: "this.json",
    dataType: "json",
    cache: false,
    success: function(data) {
        inputJSON = data;
 
     
                 
        var topSchema = {
            model: {   
                id:"_secnum",
                children: "section",
                hasChildren: (e)=> e.section
                 
                 
            }
        };
     
        var oh = kendo.observableHierarchy(
        {
            data:   [inputJSON],
            schema: topSchema
         
        });
        var viewModel = kendo.observable({
            root: oh,
            updateSomething: function(){
                var r = this.get("root");
                var g = elementMapping[4];
                 
                g.set("_name", "test this thing");
                 
            }
        });
         
        var rec = function(r){
            elementMapping[r.id]=r;
            r.items.forEach(h=>rec(h));
        }
        viewModel.root._dataSource.data().forEach(e=>rec(e));
         
         
         
        kendo.bind($("body"), viewModel);          
      
     
         
         
    }
});
     
</script>
 
 
 
</body>
</html>

 

{
    "_template": "Electronic Procedures Template",
    "_revision": "1.4.0",
    "section": [
        {
            "_name": "Cover Page",
            "_secnum": "",
            "rititle1": [ ],
            "rinumber1": [ ],
            "rititle2": [ ],
            "rinumber2": [ ]
        },
        {
            "_name": "Purpose",
            "_secnum": "1",
            "_sectype": "text"
        },
        {
            "_name": "Scope",
            "_secnum": "2",
            "_sectype": "text",
            "section": [
                {
                    "_name": "Responsibilities",
                    "_secnum": "1",
                    "_sectype": "text"
                },
                {
                    "_name": "Background",
                    "_secnum": "2",
                    "_sectype": "text"
                }
            ]
        },
        {
            "_name": "Precautions & Limitations",
            "_secnum": "3",
            "_sectype": "text"
        },
        {
            "_name": "Prerequisite Actions",
            "_secnum": "4",
            "section": [
                {
                    "_name": "Radiological Concerns",
                    "_secnum": "1",
                    "_sectype": "text"
                },
                {
                    "_name": "Employee Safety",
                    "_secnum": "2",
                    "_sectype": "text"
                },
                {
                    "_name": "Special Tools and Equipment, Parts, and Supplies",
                    "_secnum": "3",
                    "_sectype": "text"
                },
                {
                    "_name": "Approvals & Notifications",
                    "_secnum": "4",
                    "_sectype": "single",
                    "procedure": {
                        "_seq": "9",
                        "_sid": "0",
                        "_refid": "",
                        "_pagetype": "Master",
                        "_procedurelevel": "1"
                    }
                },
                {
                    "_name": "Preliminary Actions",
                    "_secnum": "5",
                    "_sectype": "single",
                    "procedure": {
                        "_seq": "10",
                        "_sid": "0",
                        "_refid": "",
                        "_pagetype": "Master",
                        "_procedurelevel": "1"
                    }
                },
                {
                    "_name": "Field Preparations",
                    "_secnum": "6",
                    "_sectype": "single",
                    "procedure": {
                        "_seq": "11",
                        "_sid": "0",
                        "_refid": "",
                        "_pagetype": "Master",
                        "_procedurelevel": "1"
                    }
                }
            ]
        },
        {
            "_name": "Performance",
            "_secnum": "5",
            "_sectype": "multiple"
        },
        {
            "_name": "References",
            "_secnum": "6",
            "section": [
                {
                    "_name": "Performance References",
                    "_secnum": "1",
                    "_sectype": "text"
                },
                {
                    "_name": "Source Requirements",
                    "_secnum": "2",
                    "_sectype": "text"
                }
            ]
        },
        {
            "_name": "Records",
            "_secnum": "7",
            "_sectype": "text"
        },
        {
            "_name": "Attachments",
            "_secnum": "8",
            "_sectype": "text"
        },
        {
            "_name": "Monitor Response 1",
            "_secnum": "11",
            "_sectype": "monitortable"
        }
    ],
    "hashcode": "e388152e636cf0a2779c2da2dca7a534"
}

 

 

 

Boyan Dimitrov
Telerik team
 answered on 25 Jan 2017
1 answer
788 views

Is there way to hook the Edit button in the row to navigate to another template?  I would like to navigate to another template that has a hierarchical grid that would display relevant data.  In this case the initial grid shows a listing of tests. 

When the user clicks the "edit" button in the grid I want to navigate to another page representing the questions and answers for the selected test in a hierarchical grid.  So how could the second page's Grid pass the testId from the action (URL) to the Read() function specified in the grid?

 

Thanks!

Alex Hajigeorgieva
Telerik team
 answered on 25 Jan 2017
1 answer
2.1K+ views

I am using the Kendo UI angular editor and need to save both the markup and the plain text from inside the control. I would like to keep the markup text encoded. This editor is being used within a custom template for a Kendo UI Grid popup edit.  From what I have researched, I see two possible options to handle this. 

  1. Write code to programmatically call the cleanFormatting toolbar method, save the original copy of the text, create a range of the body of the editor, select this range, call the cleanFormatting method, and save the new copy of the text. 
  2. Programmatically replace all markup in the original copy of the text using some jQuery approach.

I would think that the first option would be the cleanest since it would be using Kendo throughout. However, the original copy of the text is encoded and calling the cleanFormatting method does not seem to call the exec method listed in the tools array for the editor. Furthermore, all HTML tags are still present.  This is what I have so far for my tools and for the create method for my grid:

vm.editorOptions = {
    tools: [
        {
            name: 'cleanFormatting',
            tooltip: 'Clean formatting',
            exec: function (e) {
                console.log('ready to clean');
                var editor = $(this).data('kendoEditor');
                editor.exec('cleanformatting');
            }
        },
        'insertUnorderedList',
        'insertOrderedList',
        'foreColor',
        'backColor'
    ],
    execute: function(e){console.log("executing command", e.name, e.command);}
};
function createLogEntry(options) {
    var markup = options.data.markupText;
    console.log(markup);
    var editor = $('table.k-editor.k-editor-widget').kendoEditor().data('kendoEditor');
    var range = editor.createRange();
    range.selectNodeContents(editor.body);
    editor.selectRange(range);
    editor.exec('cleanFormatting');
    options.data.plainText = options.data.markupText;
    console.log(options.data);   //...
}

When I use the button on the editor itself, I get exactly what I want. Is there a way to handle this programmatically, or is that not possible?

Because of the encoding, getting a jQuery method to strip the tags does not seem to work either.  I have tried a few approaches, including 

var markup = options.data.markupText;
var plain = $('<div>' + markup + '</div>').text();

That seems to keep all the HTML tags that are inside the string, though.

Is there some way to do this with Kendo editor?  Thanks for all your help!

Ianko
Telerik team
 answered on 25 Jan 2017
1 answer
115 views

Is it possible to access the data of a column/field in a template like a row template in a razor template?
for instance : <li><label>Parent Test :</label>&nbsp; <strong>#= ParentTest #</strong></li>   

@{

    // How would I get the value of this var?

   var parentTest = ?

}

 

Thanks

 

Dimiter Topalov
Telerik team
 answered on 25 Jan 2017
1 answer
449 views

First of all, someone should review the code in these forums so that if a user hits the backspace key when creating a new post the page does not navigate back!  So this is my second attempt to post this question because my first 95% complete post was vaporized when I hit the backspace key.  [arg!]

I am basing the code from this documentation:
http://docs.telerik.com/kendo-ui/controls/editors/editor/overview

I have a razor form with two editors on them and am formatting them as in the link above but they are showing up as read only.  Also the data from the model is not populating the control.  I tried using a standard input control as well with the same results.

Here is the code:

<p>
  @Html.TextAreaFor(m => m.Test.IntroText, new {style = "width:591px", id = "introtext"})
</p>

I tried removing the style attribute above with no change.

Here is the JavaScript:

$("#thankyoutext").kendoEditor({
    resizable: {
        content: true,
        toolbar: true,
        editable : true  <<-- Just tried that does not change anything
    },
    tools: [
        "bold",
        "italic",
        "underline",
        "strikethrough",
        "justifyLeft",
        "justifyCenter",
        "justifyRight",
        "justifyFull",
        "insertUnorderedList",
        "insertOrderedList",
        "indent",
        "outdent",
        "createLink",
        "unlink",
        "insertImage",
        "insertFile",
        "subscript",
        "superscript",
        "createTable",
        "addRowAbove",
        "addRowBelow",
        "addColumnLeft",
        "addColumnRight",
        "deleteRow",
        "deleteColumn",
        "viewHtml",
        "formatting",
        "cleanFormatting",
        "fontName",
        "fontSize",
        "foreColor",
        "backColor",
        "print"
    ]
 
});
 
var editor = $("#thankyoutext").data("kendoEditor"),
editorBody = $(editor.body);
editorBody.attr("contenteditable", true).find("a").off("click.readonly");

 

Can someone help explain why it is greyed, read-only and does not contain data from the model?

 

Reid




 

Marin Bratanov
Telerik team
 answered on 25 Jan 2017
2 answers
484 views

I am looking for a way to hide either the toolbar or the buttons with in it.  I am using angular with the batch editing and when I disenable the grid I want to be able to  be able to either hid or disable the batch toolbar.

 

I have found example like this that work for MVC or JS approaches, using the databound function,

http://www.telerik.com/forums/how-do-you-remove-toolbar-separators

I have also tried doing it this way, while it does find the element, there are no valid methods or properties

var elements = document.getElementsByClassName("k-grid-toolbar");
while (elements.length > 0) {
elements[0].parentNode.removeChild(elements[0]);
}
steve
Top achievements
Rank 1
 answered on 25 Jan 2017
8 answers
603 views
Hi,
We have a angularJS project and we work also with Kendo UI (Grid)
We want to bind the Grid dataSource with $http Service.
All the official examples of AngularJS & Kendo are binding to local dataSource or WCF(.svc) links:
http://demos.telerik.com/kendo-ui/grid/angular (attached src1) 

Can you show me or send a reference for best practice way to bind kendo with $http Service.  

thanks in advance. 
Kiril Nikolov
Telerik team
 answered on 25 Jan 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
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
SegmentedControl
+? more
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?