Telerik Forums
Kendo UI for jQuery Forum
1 answer
568 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
228 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
542 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
3 answers
379 views

I am trying to initialize kendo-grid however I am getting strange error which is not traceable.

I have splitter in the page which was working. When I add the grid, I get following error in console.

angular.js:12450 TypeError: Cannot read property 'removeAttribute' of undefined
    at link (http://localhost:8080/dv/SiteOptimizer/libs/telerik.kendoui.professional.2015.3.1111.commercial/js/kendo.custom.min.js:9:50947)
    at $ (http://localhost:8080/dv/SiteOptimizer/libs/angular-1.4.6/angular.min.js:73:89)
    at K (http://localhost:8080/dv/SiteOptimizer/libs/angular-1.4.6/angular.min.js:62:39)
    at h (http://localhost:8080/dv/SiteOptimizer/libs/angular-1.4.6/angular.min.js:54:410)
    at h (http://localhost:8080/dv/SiteOptimizer/libs/angular-1.4.6/angular.min.js:54:433)
    at h (http://localhost:8080/dv/SiteOptimizer/libs/angular-1.4.6/angular.min.js:54:433)
    at h (http://localhost:8080/dv/SiteOptimizer/libs/angular-1.4.6/angular.min.js:54:433)
    at h (http://localhost:8080/dv/SiteOptimizer/libs/angular-1.4.6/angular.min.js:54:433)
    at http://localhost:8080/dv/SiteOptimizer/libs/angular-1.4.6/angular.min.js:53:480
    at http://localhost:8080/dv/SiteOptimizer/libs/angular-ui-router.min.js:7:23478 

Strangely when I remove splitter and add only the grid, it works fine.

Can you help me with what is happening here?

Vladimir Iliev
Telerik team
 answered on 29 Nov 2016
1 answer
110 views

Hello,
I'm using kendo ui in an angular (1.5.8) SPA and noticed a memory switching between 2 views.
View A: with kendo ui toolbar (without options, so no toolbar items).
View B: without kendo ui toolbar.
Switching from View A to View B and back to View A adds exactly 80 objects in memory (aprox. 4.2 kB).
Since i use the toolbar in a lot of views and nested views the memory usage over time goes up dramatically.
Calling the toolbar.destroy() on the destroy event of the angular component controller doesn't make any difference.
It looks like it has something to do with the overflow button which apparently gets a new data-uid every time and stays in the jquery tokencache.

Is this a known issue and/or how can this be fixed ?

Thanks in advance

Alexander Valchev
Telerik team
 answered on 29 Nov 2016
7 answers
547 views

Hello, 

I'd like to update the title field of my event dynamically. I can do this by using jquery to select the title input and updating its value. Example,

$('[name="title"]').val("New Test Title")

 This updated value is based on another dropdown and therefor is evaluated dynamically so cannot be set in the configuration.

 However, when I save the event the title does not save with the updated value. Is there a way I can force the underlying event object to bind to the value dynamically added to the title input. 

Thanks 

Vladimir Iliev
Telerik team
 answered on 29 Nov 2016
6 answers
436 views
Hi,

Wie have recognized some problems with globalization.
We are using Kendo COmplete ASP.NET MVC.

Culture de-DE ist working fine, but when browser culture ist de-AT or de-CH texts in scheudler or grid are in english default language.
e.g. in scheduler:
 right upper buttons in de-DE: "Tag" "Woche" "Monat" as expected.
 right upper buttons in de-AT or de-CH: "Day" "Week" "Month"

or in grid view: right left bottom corner: in de-DE: "Elemente" as expected, but in de-AT or de-CH "items"

How can I fix this?


regards
O.
Marcel Härry
Top achievements
Rank 1
 answered on 29 Nov 2016
2 answers
4.0K+ views
Hello,

I need a column with a link that works just like a command button.  For example, an ItemNo column, where the item # is a link which can be clicked to bring up a kendo-window that displays details for that item.  

The item-lookup grid I am working on is encapsulated in a custom AngularJs directive.  

Here is one thing I tried in the column definition: 
field: "ItemNo", title: "Item #", width: 120,
template: "<a href='\\#' class='link' onclick='displayItemDetails(\"#=ItemNo#\")'>#=ItemNo#</a>",
But it cannot find the "displayItemDetails" method (I have tried defining the method both on the directive's $scope and and as a "stand-alone" function, but no luck.  It works fine with a regular command column (except for the fact that it renders a button, and I need a link).  

Also, if at all possible, I would rather not use jQuery to hook up a click handler, since that violates AngularJS best practices.

If someone could provide a working example of how to do this, I would much appreciate it!

Thanks,
Lars

Venu
Top achievements
Rank 1
 answered on 29 Nov 2016
1 answer
70 views

I have a grid with a checkbox template. When I check a checkbox, and click Edit, I get a popup window, which is expected, when I close the popup window, I destroy the grid and rebind the grid again.

When I go to select another record to edit and check that checkbox, then all of a sudden the checkbox of the very first row gets checked as well, and it doesnt matter which checkbox I check, because it also checks the first rows checkbox

The code I am using is

var vendorGrid,
    CreateVendorGrid = function (newData) {
    $("#Vendor-Grid").kendoGrid({
        dataSource: {
            data: newData
        },
        schema: {
            model: {
                fields: {
                    VendorID: { type: "number" }
                },
            }
        },
        filterable: {
            mode: "row"
        },
        columns: [
            {
                template: "<input name='Selected' class='checkbox' type='checkbox'>",
                width: "30px"
            },
            {
                field: "VendorName",
                title: "Vendor",
                filterable: {
                    cell: {
                        showOperators: false,
                        operator: "contains"
                    }
                }
            },
            {
                field: "Email",
                title: "Email",
                filterable: {
                    cell: {
                        showOperators: false,
                        operator: "contains"
                    }
                }
            },
            {
                field: "Phone",
                title: "Phone",
                filterable: false
            },
            {
                field: "City",
                title: "City",
                filterable: false
            }],
        scrollable: true,
        sortable: true,
        pageable: {
            pageSize: 20
        },
        selectable: "row",
        height: $("#Vendor-Grid").closest(".col-height-full").height()-60,
        change: function (e) {
        }
    }).data("kendoGrid");
}
 
//This to get the data to populate the grid
 
function GetVendorGridData() {
    kendo.ui.progress($("#Vendor-Grid"), true);
    $.ajax({
        type: "GET",
        url: URLParam.GetVendorsForGrid,
        dataType: "json",
        contentType: "application/json; charset=utf-8",
        success: function (data, textStatus, jqXHR) {
            CreateVendorGrid(data);
            kendo.ui.progress($("#Vendor-Grid"), false);
        }
    });
}
 
//This is part of my script in my popup window for closing the window
 
$("#btnCloseVendorEditor").click(function () {
    RefreshVendorGrid();
    GetVendorGridData();
    CloseTheWindow();
});
 
function RefreshVendorGrid() {
    var theGrid = $('#Vendor-Grid').data('kendoGrid');
    theGrid.destroy();
}
Chris
Top achievements
Rank 1
 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
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?