Telerik Forums
Kendo UI for jQuery Forum
1 answer
139 views
The editor sample on http://demos.telerik.com/aspnet-mvc/editor/imagebrowser does not show an implementation of FileBrowserController, and it does not say anything about it being required.

Maybe you could add the FileBrowserController to the sample page?

Just a thought :-)
Alex Gyoshev
Telerik team
 answered on 15 Oct 2014
2 answers
807 views
Hi, I'm new to Kendo, but I've gotten the datepicker and droplist/with datasource to work. However, I'm stuck on the grid.

The grid renders fine on the page, but it says "No items to display". There are no errors in the console. In the console, I can see the browser fetch the JSON when I click refresh, and it contains all the JSON data (101 rows). Here is a sample: 

 JSON sample:
[
    {
        "id": 1,
        "email": "xxx@hotmail.com",
        "first_name": "Nellie",
        "last_name": "Bogan"
    },
    {
        "id": 2,
        "email": "xxx@stammfunk.com",
        "first_name": "Jaida",
        "last_name": "West"
    },
    {
        "id": 3,
        "email": "xxx@yahoo.com",
        "first_name": "Vito",
        "last_name": "Ortiz"
    },

...and so on.




PHP code:
$transport = new \Kendo\Data\DataSourceTransport();
$read = new \Kendo\Data\DataSourceTransportRead();
 
$read->url('/data/users')
->contentType('application/json')
->type('POST');
 
$transport ->read($read)
->parameterMap('function(data) {
return kendo.stringify(data);
}');
 
$model = new \Kendo\Data\DataSourceSchemaModel();
 
$contactFirstNameField = new \Kendo\Data\DataSourceSchemaModelField('first_name');
$contactFirstNameField->type('string');
 
$contactLastNameField = new \Kendo\Data\DataSourceSchemaModelField('last_name');
$contactLastNameField->type('string');
 
$contactEmailField = new \Kendo\Data\DataSourceSchemaModelField('email');
$contactEmailField->type('string');
 
$contactIdField = new \Kendo\Data\DataSourceSchemaModelField('id');
$contactIdField->type('number');
 
$model->addField($contactFirstNameField)
->addField($contactLastNameField)
->addField($contactEmailField)
->addField($contactIdField);
 
$schema = new \Kendo\Data\DataSourceSchema();
$schema->data('data')
->errors('errors')
->groups('groups')
->model($model)
->total('total');
 
$dataSource = new \Kendo\Data\DataSource();
 
$dataSource->transport($transport)
->pageSize(10)
->serverPaging(true)
->serverSorting(true)
->serverGrouping(true)
->schema($schema);
 
$grid = new \Kendo\UI\Grid('grid');
 
$first_name = new \Kendo\UI\GridColumn();
$first_name->field('first_name')
->title('First Name')
->width(140);
 
$last_name = new \Kendo\UI\GridColumn();
$last_name->field('last_name')
->title('Last Name')
->width(190);
 
$email = new \Kendo\UI\GridColumn();
$email->field('email')
->title('Email');
 
$id = new \Kendo\UI\GridColumn();
$id->field('id')
->title('ID')
->width(110);
 
$pageable = new Kendo\UI\GridPageable();
$pageable->refresh(true)
->pageSizes(true)
->buttonCount(5);
 
$grid->addColumn($first_name, $last_name, $email, $id)
->dataSource($dataSource)
->sortable(true)
->groupable(true)
->pageable($pageable)
->attr('style', 'height:380px');
 
?>
 
 
<div id="clientsDb">
  <?php
  echo $grid->render();
  ?>
</div>
 
<style scoped>
  #clientsDb {
    width: 952px;
    height: 396px;
    margin: 20px auto 0;
    padding: 51px 4px 0 4px;
  }
</style>

Steven
Top achievements
Rank 1
 answered on 15 Oct 2014
3 answers
2.3K+ views
I am working on MVC project using knockout JS.

I need to enable & disable the kendoNumericTextbox control on checkbox value. 

But I need to disable the numeric control when checkbox is checked. i.e if
checked = true then enabled = false. Is there a way to pass the inverse value
to numeric enabled option.

And I have to implement similar functionality to KendoDatepicker. Could you
please suggest any solution for both the controls. Here is my code - 

 <input class="" type="text"
data-bind="kendoNumericTextBox: {value:FloatValue, min: 0.01, decimals: 2,
format: 'n2' , enabled:CheckboxValue} " />
   

 <input type="checkbox" data-bind="checked:
CheckboxValue">  Null
Kiril Nikolov
Telerik team
 answered on 15 Oct 2014
2 answers
120 views

I am getting this error while binding the grid using asp.net MVC Any one can help me to resolve this???









Rosen
Telerik team
 answered on 15 Oct 2014
0 answers
237 views
Hi there,


Just thought I would like to share my color picker for the editor, similar to the one in Microsoft Word:

@(Html.Kendo().Editor()
.Name("Editor")
.Tools(tools => tools
    .Clear()
    .Bold().Italic().Underline().Strikethrough()
    .JustifyLeft().JustifyCenter().JustifyRight().JustifyFull()
    .InsertUnorderedList().InsertOrderedList()
    .Outdent().Indent()
    .CreateLink().Unlink()
    .InsertImage()
    .InsertFile()
    .SubScript()
    .SuperScript()
    .TableEditing()
    .ViewHtml()
    .CleanFormatting()
    .Formatting()
    .FontName()
    .FontSize()
    .FontColor(color => color.Palette(new string[] {
        "#ffffff", "#000000", "#e7e6e6", "#44546a", "#5b9bd5", "#ed7d31", "#a5a5a5", "#ffc000", "#4472c4", "#70ad47",
        "#f2f2f2", "#7f7f7f", "#d0cece", "#d6dce4", "#deebf6", "#fbe5d5", "#ededed", "#fff2cc", "#d9e2f3", "#e2efd9",
        "#d8d8d8", "#595959", "#aeabab", "#adb9ca", "#bdd7ee", "#f7cbac", "#dbdbdb", "#fee599", "#b4c6e7", "#c5e0b3",
        "#bfbfbf", "#3f3f3f", "#757070", "#8496b0", "#9cc3e5", "#f4b183", "#c9c9c9", "#ffd965", "#8eaadb", "#a8d08d",
        "#a5a5a5", "#262626", "#3a3838", "#323f4f", "#2e75b5", "#c55a11", "#7b7b7b", "#bf9000", "#2f5496", "#538135",
        "#7f7f7f", "#0c0c0c", "#171616", "#222a35", "#1e4e79", "#833c0b", "#525252", "#7f6000", "#1f3864", "#375623",
        "#c00000", "#ff0000", "#ffc000", "#ffff00", "#92d050", "#00b050", "#00b0f0", "#0070c0", "#002060", "#375623",
  }))
    .BackColor(color => color.Palette(new string[] {
        "#ffffff", "#000000", "#e7e6e6", "#44546a", "#5b9bd5", "#ed7d31", "#a5a5a5", "#ffc000", "#4472c4", "#70ad47",
        "#f2f2f2", "#7f7f7f", "#d0cece", "#d6dce4", "#deebf6", "#fbe5d5", "#ededed", "#fff2cc", "#d9e2f3", "#e2efd9",
        "#d8d8d8", "#595959", "#aeabab", "#adb9ca", "#bdd7ee", "#f7cbac", "#dbdbdb", "#fee599", "#b4c6e7", "#c5e0b3",
        "#bfbfbf", "#3f3f3f", "#757070", "#8496b0", "#9cc3e5", "#f4b183", "#c9c9c9", "#ffd965", "#8eaadb", "#a8d08d",
        "#a5a5a5", "#262626", "#3a3838", "#323f4f", "#2e75b5", "#c55a11", "#7b7b7b", "#bf9000", "#2f5496", "#538135",
        "#7f7f7f", "#0c0c0c", "#171616", "#222a35", "#1e4e79", "#833c0b", "#525252", "#7f6000", "#1f3864", "#375623",
        "#c00000", "#ff0000", "#ffc000", "#ffff00", "#92d050", "#00b050", "#00b0f0", "#0070c0", "#002060", "#375623",
  }))
).Encode(false)
.Value(@<text>
  <p>
      Kendo UI Editor allows your users to edit HTML in a familiar, user-friendly way.<br />
      In this version, the Editor provides the core HTML editing engine, which includes basic text formatting, hyperlinks, lists,
      and image handling. The widget <strong>outputs identical HTML</strong> across all major browsers, follows
      accessibility standards and provides API for content manipulation.
  </p>
  <p>Features include:</p>
  <ul>
      <li>Text formatting & alignment</li>
      <li>Bulleted and numbered lists</li>
      <li>Hyperlink and image dialogs</li>
      <li>Cross-browser support</li>
      <li>Identical HTML output across browsers</li>
      <li>Gracefully degrades to a <code>textarea</code> when JavaScript is turned off</li>
  </ul>
  <p>
      Read <a href="http://docs.telerik.com/kendo-ui">more details</a> or send us your
      <a href="http://www.telerik.com/forums">feedback</a>!
  </p>
</text>)
.ImageBrowser(imageBrowser => imageBrowser
    .Image("~/Content/UserFiles/Images/{0}")
    .Read("Read", "ImageBrowser")
    .Create("Create", "ImageBrowser")
    .Destroy("Destroy", "ImageBrowser")
    .Upload("Upload", "ImageBrowser")
    .Thumbnail("Thumbnail", "ImageBrowser"))
.FileBrowser(fileBrowser => fileBrowser
    .File("~/Content/UserFiles/Images/{0}")
    .Read("Read", "FileBrowser")
    .Create("Create", "FileBrowser")
    .Destroy("Destroy", "FileBrowser")
    .Upload("Upload", "FileBrowser"))
)

And the css styles to go along with that:

.k-colorpalette
{
    border: 1px solid gray;
    padding-right: 3px;
}
 
.k-palette .k-item
{
    border-style: solid;
    border-color: White;
    border-width: 0px 3px 0px 3px;
}
 
.k-palette tr:first-child
{
    border-top: 3px solid white;
    border-bottom: 5px solid white;
}
 
.k-palette tr:last-child
{
    border-top: 5px solid white;
    border-bottom: 3px solid white;
}
Lasse
Top achievements
Rank 1
 asked on 15 Oct 2014
1 answer
416 views
Hi there,

I have a tree view control on my view and I am binding to a json data source in controller code.

       <div kendo-tree-view="tvc.tree"
            k-data-source="tvc.treeData"
            k-options="tvc.treeOptions">
        </div>


Controller Code :

$scope.tvc = {};

        $scope.tvc.treeData = new kendo.data.HierarchicalDataSource({
            transport: {
                read: {
                    url: options.api.base_url + "/GeoCodeData",
                    dataType: "json"
                }
            },
            schema: {
                model: {
                    id: "GeoCode",
                    hasChildren: function (e) {
                        return true;
                    }
                }
            }
        });

        $scope.tvc.treeOptions = {
            checkboxes: {
                checkChildren: true
            },
            dataTextField: "GeoCode"
        };


Everything works fine when it loads the root node. On subsequent expansion of nodes, it fetches data again by querying datasource. The only parameter passed is "GeoCode" which is defined in schema model.

My requirement is to pass additional filters. The model, with which tree view is binding contains 3 properties. I need to pass like this.

http://localhost:4416/api/GeoCodeData?GeoCode=US&GeoLvl=1

Currently, it is fetching like this :

http://localhost:4416/api/GeoCodeData?GeoCode=US

Any pointers will be appreciated.

Thanks.
Alex Gyoshev
Telerik team
 answered on 15 Oct 2014
1 answer
784 views
I am new to Angular JS and having basic knowledge on
directives, modules, controllers and scope.

I got a requirement to develop multiple kendo charts with
Angular JS so decided to make a “custom directive” for kendo charts to make it
reusable throughout the project.

I am able to declare all the chart options like data source,
series, series defaults, legend position and categories in custom directives.
This is working at the time of initial load. But, once I change the data source
(data source is scope variable in controller) the chart is not getting
reflected.

This is an urgent requirement for us. Please help me on this
to come out from tough situation. Any help is highly appreciated on below
areas:

1.      
I have filter area along with refresh button.
User selects the filter conditions and click on refresh button. On clicking
refresh, I need to update the chart. But, initially loading is happening not on
updating anyone of the value.

2.      
Need to update the custom directive template
(kendo chart) on updating anyone of the chart properties like data source,
series, series defaults, legend position and categories.

Below is the code I tried:

Custom Directive:

var app = angular.module("myserviceApp", ['kendo.directives']);

 

app.directive('customdirectiveforkendochart', function () {

return {

        restrict: 'E',

        scope: {           

            legendposition: '=',

            datasource: '=',

            seriesdefaults: '=',

            chartseries: '=',

            categoryAxis: '='

        },

        controller: ['$scope',function ($scope) {

                   }],

        link: function (scope, element, attrs) {           

            scope.$watch("chartseries", function (value) {

//Tried
to update the chart on changing of chart series but no luck.

                scope.series = new
kendo.dataviz.SeriesBind(scope.chartseries);            });           

        },

        template: '<div kendo-chart k-legend="legendposition"
k-series-defaults="{{seriesdefaults}}"
k-series="chartseries"
k-category-axis="{{categoryAxis}}"></div'

    };

});

 

Controller:

 

var app = angular.module("myApp", ['myserviceApp','kendo.directives']);

 

app.controller("myCtrl", function ($scope, $compile)
{

 

$scope.legendposition
= "top";

 

    $scope.seriesDefaults = {

        type: "line",

        stack: false

    };

 

    $scope.series = [

              {

                 
name: "Sample Seats",

                 
data: $scope.seats //Array of values

              },

            {

                name: "Sample user count",

                data: $scope.activeUsers
//Array of values

            }

    ];

 

    $scope.categoryAxis = {

        categories: $scope.categories,

        baseUnit: $scope.category,

        majorGridLines: {

            visible: false

        }

    };

}

HTML:

<'customdirectiveforkendochart' legendposition="legendposition" seriesdefaults="seriesDefaults" chartseries="series" category-Axis="categoryAxis"  ></customdirectiveforkendochart>               

T. Tsonev
Telerik team
 answered on 15 Oct 2014
3 answers
204 views
OK, I'm using pie chart, and did not define any colors for each of the series at first. It seems the Chart uses 6 default colors and rotates them. The problem came where there are 7 slices on one of my pie charts. So... The 7th slice is the same color as the first slice, since it's rotating, and these two slices now look like a single slice with the same color.

I fixed it myself by manually assign the same 6 color rotation to each series, check for the last color and ensure it's not the same as the first, then advance to the next color.

Nether less, this should be fixed.

Aaron
Hristo Germanov
Telerik team
 answered on 15 Oct 2014
10 answers
388 views
Hi:
Do you have example on how to do editing on grid templating in your example detail template where the Contact tab data is from the same datasource and when editing is enabled and when user changed the data on the tab form, how can the save button will do the saving for the grid including the customer tab form data changed.

Also the field template of setting null to blank is not carrying over to the tab templated form data?


Thanks,
Cory
Top achievements
Rank 1
 answered on 14 Oct 2014
1 answer
328 views
Hello There

I'm trying to convert the WebSushi application for Typescript.

For some reason, when you use a class the Kendo Template is not able to discover the parent().parent().

class MyViewModel extends kendo.data.ObservableObject {
    items: kendo.data.DataSource;
    constructor(myItems: kendo.data.DataSource) {
        super();
        super.init(this);
        this.items = myItems;
    }
 
    addToCart(e): void {
        alert("Hello There!");
    }
}
 
var myData: Array<any> = [
    { "id": 1, "name": "Sashimi salad", "price": 12.0, "image": "http://demos.telerik.com/kendo-ui/content/spa/websushi/images/200/sashimi-salad.jpg", "category" : "Cold starters", "description" : "Organic greens topped with fresh sashimi, wasabi soy vinaigrette.", "featured" : true },
    { "id": 2, "name": "Chirashi sushi", "price": 21.0, "image": "http://demos.telerik.com/kendo-ui/content/spa/websushi/images/200/chirashi-sushi.jpg", "category" : "Cold starters", "description" : "Sushi bar variety with sushi rice.", "featured" : false
}];
 
var myItems = new kendo.data.DataSource({ schema: { model: {} }, data: myData });
var viewModel: MyViewModel = new MyViewModel(myItems);
var myView = new kendo.View("index-template", { model: viewModel });
myView.render($("#application"));

Here are the templates, the same as we have in WebSushi:
<script type="text/x-kendo-template" id="index-template">
        <ul data-role="listview" data-bind="source: items" data-template="item" id="main"></ul>
    </script>
<script type="text/x-kendo-template" id="item">
        <li class="products">
            <a class="view-details" href="\#">
                <img class="main-image" src="#= image #" alt="#: name#" title="#: name #" />
                <strong data-bind="text: name"></strong>
                <span class="price"><span>$</span><span data-bind="text: price"></span></span>
            </a>           
            <button class="add-to-cart" data-bind="click: addToCart">Add to cart</button>
        </li>
</script>
 
<div id="application"></div>

The point is, I cannot catch the addToCart click event with MyViewModel.
If I debug, the model.parent().parent() is missing.

But! If I use only Javascript like the WebSushi it works.
var indexModel = kendo.observable({
    items: myItems,
 
    addToCart: function (e) {
        alert("Hello There!");
    }
});

What am I doing wrong?

Please, check the example here:
http://jsfiddle.net/ertzajLn/6/

Thanks!
Guilherme
Top achievements
Rank 1
 answered on 14 Oct 2014
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
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?