Telerik Forums
Kendo UI for jQuery Forum
1 answer
757 views

Hi,

I am following example the here to implement kendo ui treeview with remote data binding http://demos.telerik.com/kendo-ui/treeview/remote-data-binding

On expanding a node I need to dynamically pass couple of parameters to get the child items. The given example works perfectly for one parameter. How can I add another parameter? The value of my second parameter comes from one of the columns of the datasource itself.

Thanks

 

 

Peter Milchev
Telerik team
 answered on 30 Nov 2016
1 answer
256 views
Hello,


Is it possible to skip a group template if there's no value in a group field?

For example, I want to group on category and sub-category and I want to display data in the following way:

- Category: 'Automative'

--Sub-category: 'Cars'

----Ferrari

----Lamborghini

--Sub-category: 'Tyres'

---Bridgestone

----Michelin

-Category: 'Bikes'

-- Peugeot

-- Trek




The products in the 'Bikes' category don't have a sub-category - they belong straight to the top category. Unfortunately, if I do grouping on both 'category' and 'sub-category', Kendo UI Grid will add an empty grouping template for the missing sub-category.


Is it somehow possible to skip a group template, if there's no value in a group column?

I've tried using a function for `groupHeaderTemplate`, but unfortunately, it can only put an empty values in a template, it cannot skip the whole group template.

Thanks,

Mike
Dimiter Topalov
Telerik team
 answered on 30 Nov 2016
1 answer
250 views

Hi!

I need to share my current bundle config and _Layout so that someone can correct me if I'm loading too many CSS/Scripts then needed.

BundleConfig:

public class BundleConfig
{
 
private const string KendoVersion = "2016.3.1118";
 
public static void RegisterBundles(BundleCollection bundles)
{
 
    #region Scripts
 
    bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
        "~/Scripts/jquery-{version}.js",
        "~/Scripts/jquery.scrollUp.min.js",
        "~/Scripts/moment.min.js"));
 
    bundles.Add(new ScriptBundle("~/bundles/jqueryMigrate").Include(
        "~/Scripts/jquery-migrate-3.0.0.min.js"));
 
    bundles.Add(new ScriptBundle("~/bundles/niceScroll").Include(
        "~/Scripts/NiceScroll/jquery.nicescroll.min.js"));
 
    bundles.Add(new ScriptBundle("~/bundles/perfectScrollbar").Include(
        "~/Scripts/perfect-scrollbar.jquery.min.js"));
 
    bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
        "~/Scripts/jquery.validate*"));
 
    bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
        "~/Scripts/modernizr-*"));
 
    bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
        "~/Scripts/bootstrap.min.js",
        "~/Scripts/respond.min.js"));
 
    bundles.Add(new ScriptBundle("~/bundles/kendo").Include(
        "~/Scripts/kendo/" + KendoVersion + "/kendo.all.min.js",
        "~/Scripts/kendo/" + KendoVersion + "/kendo.angular2.min.js",
        "~/Scripts/kendo/" + KendoVersion + "/kendo.aspnetmvc.min.js",
        "~/Scripts/kendo/" + KendoVersion + "/kendo.timezones.min.js",
        "~/Scripts/kendo/" + KendoVersion + "/cultures/kendo.culture.en-US-Custom.min.js",
        "~/Scripts/kendo/" + KendoVersion + "/jszip.min.js"));
 
    bundles.Add(new ScriptBundle("~/bundles/custom").Include(
        "~/Scripts/globalize.js",
        "~/Scripts/metisMenu.min.js",
        "~/Scripts/buzz.js",
        "~/Scripts/dist/site.js",
        "~/Scripts/App/Module/Common.js"));
 
    #endregion
 
    #region CSS
 
    bundles.Add(new StyleBundle("~/Content/css").Include(
        "~/Content/bootstrap.min.css",
        "~/Content/site.css",
        "~/Content/normalize.css"));
 
    bundles.Add(new StyleBundle("~/Content/custom/css").Include(
        "~/Content/metisMenu.min.css",
        "~/Content/site/site.css",
        "~/Content/animate.css"));
 
    bundles.Add(new StyleBundle("~/Content/kendoThemeCommon/css").Include(
        "~/Content/kendo/" + KendoVersion + "/kendo.common.min.css"));
 
    bundles.Add(new StyleBundle("~/Content/kendoThemeCommonBootstrap/css").Include(
        "~/Content/kendo/" + KendoVersion + "/kendo.common-bootstrap.min.css"));
 
    bundles.Add(new StyleBundle("~/Content/kendoThemeBootstrap/css").Include(
        "~/Content/kendo/" + KendoVersion + "/kendo.bootstrap.min.css"));
 
    bundles.Add(new StyleBundle("~/Content/kendoRtl/css").Include(
        "~/Content/kendo/" + KendoVersion + "/kendo.rtl.min.css"));
 
    bundles.Add(new StyleBundle("~/Content/kendoMobile/css").Include(
        "~/Content/kendo/" + KendoVersion + "/kendo.mobile.all.min.css"));
 
    bundles.Add(new StyleBundle("~/Content/kendoDataViz/css").Include(
        "~/Content/kendo/" + KendoVersion + "/kendo.dataviz.min.css",
        "~/Content/kendo/" + KendoVersion + "/kendo.dataviz-bootstrap.min.css"));
 
    #endregion
 
    bundles.IgnoreList.Clear();
 
    //BundleTable.EnableOptimizations = true;
 
}

Layout:

<head>
    <meta charset="utf-8" />
    <title>@ViewBag.Title - System</title>
    <link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
    <meta name="viewport" content="initial-scale = 1.0, maximum-scale = 1.0, width = device-width">
 
    <!-- css -->
 
    @Styles.Render("~/Content/css")
    @Styles.Render("~/Content/custom/css")
 
    @Styles.Render("~/Content/kendoThemeCommon/css")
    @Styles.Render("~/Content/kendoThemeCommonBootstrap/css")
    @Styles.Render("~/Content/kendoThemeBootstrap/css")
    @Styles.Render("~/Content/kendoRtl/css")
    @Styles.Render("~/Content/kendoMobile/css")
    @Styles.Render("~/Content/kendoDataViz/css")
 
    <!-- jQuery -->
 
    @Scripts.Render("~/bundles/jquery")
    @Scripts.Render("~/bundles/jqueryMigrate")
    @Scripts.Render("~/bundles/bootstrap")
    @Scripts.Render("~/bundles/niceScroll")
    @Scripts.Render("~/bundles/kendo")
    <script type="text/javascript">
        kendo.culture("en-US");
    </script>
    @Scripts.Render("~/bundles/modernizr")
    @Scripts.Render("~/bundles/custom")
    <script src="https://use.fontawesome.com/06c55d21d7.js"></script>
</head>

Result:
I'm not getting any specific warning in console of hosting browsers but when using the Chrome's extension for Kendo, I get repeated messages regarding common.css missing. Now, I'm going for the Bootstrap style all-out. I need a all-good for the default desktop setup. I'm still a bit confused about Mobile and DataViz and DataViz Mobile. I'm about to start dashboards so I'll be loooking at mobile and DataViz too.

Ianko
Telerik team
 answered on 30 Nov 2016
8 answers
1.4K+ views

I have a remote datasource/grid with something like this as part of the datasource schema model:

model: {fields: {department_id: {type:"number"}, department: {type: "object"} ...

where the nested department object includes fields "id" and "prettyName".  The grid uses incell editing and a "save" button on the toolbar.  The columns include a field for the "department_id":

{field: 'deptID', title:"Department",
template: "#:department.prettyName#",
editor: function(container, options) {
$('<input required name="' + options.field + '"/>')
.appendTo(container)
.kendoDropDownList({

dataSource: remoteDepartmentDatasource,
dataTextField: "prettyName",
dataValueField: "id",   ...

}

This works to a point - the nested "department.prettyName" displays in the grid via the template, and with incell editing the dropdown list (which is fed records identical to the nested "department" object) correctly changes the "department_id" field to the id selected from the dropdown.  But since the grid's display value "prettyName" is coming from the original nested "department" in the grid row's dataSource record, once the editor is exited the grid displays a stale value until the update is made to the server and the server returns an updated record, which isn't until the user decides to click "Save changes".

Is there any clean way to bind things to have BOTH the department_id AND the department object updated from the edit process's dropdown list?  Or is there an event I could hook into, perhaps the dropdown's "close", where I would know enough to push the "department" object onto the record in the grid's dataSource?

Georgi Krustev
Telerik team
 answered on 30 Nov 2016
5 answers
300 views

I am using kendo ui router and want to replace a URL parameter on each change of the route. So on the change event of the router I have the following code:

 

window.history.replaceState({}, document.title, getUpdatedUrl())

The parameter I want to add is updated successfully, but when I navigate back or forward the kendo ui router no longer catches these events, and does not navigate to the appropriate view (the page URL changes properly). Any ideas how to fix this?

Boyan Dimitrov
Telerik team
 answered on 29 Nov 2016
4 answers
419 views

I have a grid that is using the popup editor with customized create and update templates.  The create is working just fine, and the update works if I change one of the dropdowns.  However, if I only change some of the text in the textbox and click the Update button, the update function in the dataSource is not run, even though the dataSource sync function runs.  Do I need to call the onChanges event of the textbox?

I am using Angular for this application, and when I make a change in the textbox, the ng-pristine class is removed and the ng-dirty class is added.  

Christy
Top achievements
Rank 1
 answered on 29 Nov 2016
1 answer
560 views

I have a kendogrid and when I add a new record and rebind the grid, the new record is not in the grid, however if I use the filter for it then I see it, but to actually see it in the grid I have to refresh my page.

When the page loads it calls this function

function GetCustomerGridData() {
    kendo.ui.progress($("#Customer-Grid"), true);
    $.ajax({
        type: "GET",
        url: URLParam.GetActiveCustomersForTheGrid,
        dataType: "json",
        contentType: "application/json; charset=utf-8",
        success: function (data, textStatus, jqXHR) {
            LoadCustomerGrid(data);
            kendo.ui.progress($("#Customer-Grid"), false);
        }
    });
}

 

The LoadCustomerGrid is this 

function LoadCustomerGrid(newData) {   
    CreateCustomerGrid(newData);
}

 

The grid itself is..

var customerGrid,
    CreateCustomerGrid = function (newData) {
        customerGrid = $("#Customer-Grid").kendoGrid({
            dataSource: {
                data: newData
            },
            schema: {
                model: {
                    CustomerID: { type: "number" }
                }
            },
            filterable: {
                mode: "row"
            },
            columns: [
                {
                    template: "<input type='checkbox' class='checkbox' />",
                    width: "30px"
                }
            {
                field: "LastName",
                title: "Last Name",
                filterable: {
                    cell: {
                        showOperators: false,
                        operator: "contains",
                        inputHeight: "34px"
                    }
                }
            },
            {
                field: "FirstName",
                title: "Name",
                filterable: {
                    cell: {
                        showOperators: false,
                        operator: "contains"
                    }
                }
            },
            {
                field: "Phone",
                title: "Phone",
                filterable: {
                    cell: {
                        showOperators: false,
                        operator: "contains"
                    }
                }
            },
            {
                field: "Address",
                title: "Address",
                filterable: {
                    cell: {
                        showOperators: false,
                        operator: "contains"
                    }
                }
            },
            {
                field: "City",
                title: "City",
                filterable: {
                    cell: {
                        showOperators: false,
                        operator: "contains"
                    }
                }
            },
            {
                field: "Zip",
                title: "Zip",
                filterable: {
                    cell: {
                        showOperators: false,
                        operator: "contains"
                    }
                }
            }
            ],
            scrollable: true,
            sortable: true,
            pageable: {
                pageSize: 20
            },
            selectable: "row",
            height: $("#Customer-Grid").closest(".col-height-full").height() - 60,
            change: function (e) {
                // Function call goes here
                var detailRow = this.dataItem(this.select());
                var optionID = detailRow.get("CustomerID")
            }
        }).data("kendoGrid");
    }

 

When I go to add a record I use a popup

function CustomerPopupEditor() {
    $("#showCustomerEdit").append("<div id='window'></div>");
    var myWindow = $("#window").kendoWindow({
        position: {
            top: 100,
            left: "30%"
        },
        width: "40%",
        title: "Add Customer",
        content: "/Customer/CustomerEditor",
        modal: true,
        actions: [
            "Close"
        ],
        close: function (e) {
            $("#window").data("kendoWindow").destroy();
        }
    }).data("kendoWindow");
    myWindow.open();
    GetStates();
    HomeStorage.Keys.AddOrEdit = "Add";
}

 

and when add a new record and click the save button, this function is called

function SubmitNewCustomer() {
    var customer = NewCustomerToSubmit();
    GetAssignmentIDs();
    $.ajax({
        type: "POST",
        url: URLParam.AddNewCustomer + "?assignments=" + HomeStorage.Keys.AssignmentIDString,
        dataType: "json",
        contentType: "application/json; charset=utf-8",
        data: JSON.stringify(customer),
        success: function (data, textStatus, jqXHR) {
            HomeStorage.Keys.NewCustomerID = data.id;           
        },
        complete: function (e) {
            GetCustomerGridData();
            ClearFields();
        }
    })
}

 

and when I close the popup on a button click event this is called

$("#btnCancel").click(function () {
    ClearFields();
    GetCustomerGridData();
    CloseTheWindow();
});

 

In the SubmitNewCustomer function I have tried putting the GetCustomerGridData() in its success function and that didnt work either.

The data being returned for the GetCustomerGridData() has over 30K records, but I dont think that should matter much. 

Any idea what I am missing?

Stefan
Telerik team
 answered on 29 Nov 2016
1 answer
221 views

Lets say, I have a model like the following:

public class AssignmentListViewModel
{
    public string JsonAssignmentList { get; set; }

}

Loading the model:

model.JsonAssignmentList = Newtonsoft.Json.JsonConvert.SerializeObject(assignmentList.Assignments);

On the client when I create new kendo.data.TreeListDataSource, I try to do the following and get error

"SCRIPT1028: Expected identifier, string or number"

var json = JSON.parse(@Model.JsonAssignmentList);
var dataSource = new kendo.data.TreeListDataSource({
@*data: JSON.stringify(@Model.JsonAssignmentList),*@
data: json,
            
// Enable batch updates
batch: true,
// Define the model schema
schema: {
model: {
id: "Id",
fields: {
Id: { type: "number", editable: false, nullable: false },
parentId: { from: "ChildAssignmentListId", type: "number", defaultValue: 0 },
Step: { validation: { required: true } },
AssigneeDisplayName: { validation: { required: true } },
Description: { validation: { required: true } },
Status: { validation: { required: true } },
StatusText: { validation: { required: true } },
Instructions: { validation: { required: false } },
//Deadline: { validation: { required: false } },
DeadlineDueDateText: { validation: { required: false } }
}
}
}
});

 

How can I return json string from the controller and bind it to a kendo treelist?

 

 

 

 

 

Boyan Dimitrov
Telerik team
 answered on 29 Nov 2016
6 answers
1.3K+ views
I have a question regarding the DropDownList control. There seems to be an issue with the way CSS-class related to focused state ("k-state-focused") is handled: sometimes it’s not removed when the control loses focus. It leads to multiple controls being highlighted as “focused” which was noticed by our customers and caused complaints. This behavior is reproducible on KendoUI demo page http://demos.telerik.com/kendo-ui/dropdownlist/index (as of version "2014.2.716"; see screenshot in the attachment, Inspector View is shown so you can see actual DOM). To reproduce:
(a) expand drop-down list by mouse click;
(b) close it back by clicking without moving mouse pointer (i.e. close drop-down list without making selection);
(c) focus other control using Tab key or mouse. 
Expected result: "k-state-focused" is removed from the control
Actual result: "k-state-focused" is still there

Code history publicly available at the GitHub suggests that commit responsible for this behavior is https://github.com/telerik/kendo-ui-core/commit/951c0ea4f29e42a251717875247b6e6e379ac783#diff-ac387d6d4912098fb93d306c9fe59421R357.
There was a code fragment starting at line 357:

that.wrapper
.on("mousedown" + ns, function(e) {
    that._wrapperClicked = true;
})

Behavior introduced in that commit is still present in the current version albeit it looks somewhat different after recent changes (https://github.com/telerik/kendo-ui-core/blob/master/src/kendo.dropdownlist.js#L358):
       
_wrapperMousedown: function() {
  this._prevent = true;
},

Is it really a defect or is there something wrong in the way we (and the demo page) use the DropDownControl?

Charles
Top achievements
Rank 1
 answered on 29 Nov 2016
3 answers
536 views

I have 3 pie charts

 

They all sit below each other but they are all different widths as the legend is on the left and the lengths of the legend lable varies.

 

How can I specify a fixed with for the legend or pie chart so that they are consistant size

Rumen
Telerik team
 answered on 29 Nov 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
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?