Telerik Forums
Kendo UI for jQuery Forum
8 answers
467 views
Hi,

I am trying to bind angular $scope data to a kendo area chart with an x-axis that shows the date and a y axis that shows values.

<div kendo-chart="connectorMetadata.appDowntimeChart"
                           k-title="{ text: 'APP DOWNTIME', visible: false }"
                           k-legend="{ visible: false }"
                           k-chart-area="{ background: '', height:220  }"
                           k-series-defaults="{ type: 'area', markers: { visible: true }, area: { line: { style: 'smooth' } } }"
                           k-series="[{ xField: 'date', yField: 'devicesUpCount' }, { xField: 'date', yField: 'devicesDownCount' }]"
                           k-x-axis="{
                                labels: { format: '{0}' },
                                title: { text: 'Time' }
                             }"
                           k-y-axis="{
                                labels: { format: '{0}' },
                                title: { text: 'Count of devices' }
                             }"
                           k-data-source="connectorMetadata.appDowntimeKSeries"
                           k-tooltip="{
                                visible: true,
                                format: '{0}%',
                                template: ' #= value # #= series.name #'
                            }"
                     >
                     </div>

The datasource has the following contents
$scope.connectorMetadata.appDowntimeKSeries = new kendo.data.DataSource({
        transport: {
            read: function(options) {

                angular.forEach($scope.connectorMetadata.appDowntimeData, function(row){
                    row.date = new Date(row.epochTime);
                })

                options.success($scope.connectorMetadata.appDowntimeData);
            }
        }
    });

where $scope.connectorMetadata.appDowntimeData is an array of objects like the below
{"epochTime":"1409179532000","devicesUpCount":"9","devicesDownCount":"49"}

The charts do not show any data. I call $scope.connectorMetadata.appDowntimeChart.dataSource.read() every time the data is updated.

What am I doing wrong here ?


T. Tsonev
Telerik team
 answered on 05 Sep 2014
1 answer
3.2K+ views
I don't see anything in the official documentation of Kendo UI. Just checking if somebody has done customization to merge the cells in Kendo UI Grid.
Kiril Nikolov
Telerik team
 answered on 05 Sep 2014
4 answers
189 views
I have a grid set up to use a filter row. When I type a character in one of the filter row headers, I can see a query being issued on the server side, complete with the text I'm typing applied as a filter in the query. But the grid doesn't update with the results until the user hits enter in the filter box or the filter loses focus (by tabbing or clicking to another control). In addition, this focus change causes a final query to be sent to the database.

I'd like to either have the grid update as the user is typing (making use of the query that's going out), or only query once, when the user hits the enter key or switches to another control, so that the extra queries aren't creating unnecessary load.

Do you have any ideas as to why the grid doesn't refresh until the enter key is pressed or the text box loses focus? Even though it's issuing queries during the act of typing?

Thanks!
Alexander Popov
Telerik team
 answered on 05 Sep 2014
3 answers
141 views
Hi there,

I'm developing a multi-user website using the scheduler as one of the key components. The site will allow multiple users to have simultaneous access to creating and view scheduler entries.

Currently, when the datasource is updated by a user, all machines viewing the datasource will have .read() called in order to refresh the view. Unfortunately, this closes any editor dialogues which is less than ideal.

Is there anyway to have the scheduler update from the datasource without closing currently open dialogues?

Cheers, Paul.
Kiril Nikolov
Telerik team
 answered on 05 Sep 2014
13 answers
488 views
Using upgraded kendo.all.min.js, grid.setdataSource() does not remove unlocked columns (see image on attached file), and script hangs up without completing processing this line of code.

Locking all columns does not result in function running successfully.

Commenting out the next to last line of grid.setDataSource():  t.selectable && t._selectable(), solves the problem and setDataSource() works as expected, except that grid rows are no longer selectable.

I created a method with setDataSource code, commented out the problem line, and now call it for our grid refresh and save routines, which call setDataSource.

This is method I call in lieu of calling grid.setDataSource():

   // source code for grid.setDataSource() with problem line commented out
    var setDataSource = function (e) {
        var grid = $('#mainGrid').data("kendoGrid");
        var t = grid;
        
        t.options.dataSource = e,
        t._dataSource(),

        t._pageable(),
        t._thead(),
        t.options.groupable && t._groupable(),
        t.virtualScrollable && t.virtualScrollable.setDataSource(t.options.dataSource),
        t.options.navigatable && t._navigatable(),

        // problem line commented out
        //t.selectable && t._selectable(),

        t.options.autoBind && e.fetch();
    } 

This works well, except we can no long select grid rows.
Please let me know how I can get around this problem and reset selectable so that it works after calling code.

I have tried  grid.options.selectable = true; with no success.

Thanks,

Bradley












Dimo
Telerik team
 answered on 05 Sep 2014
1 answer
609 views
How do I return kendo template from JavaScript function. The code below renders actual html instead of button

<script id="action-template1" type="text/x-kendo-template">
    <button class="btn btn-success"><span class="glyphicon glyphicon-ok"></span> Approve</button>
</script>
<script id="action-template2" type="text/x-kendo-template">
    <button class="btn btn-success"><span class="glyphicon glyphicon-ok"></span> Delete</button>
</script>


$grid.kendoGrid({
    dataSource: gridDS,
    autoBind: true,
    columnMenu: true,
    scrollable: false,
    sortable: false,
    filterable: {
        extra: false,
        operators: {
            string: {
                eq: "Is equal to",
                neq: "Is not equal to"
            }
        }
    },
    pageable: false,       
    columns: [
         
        {
            template: createActionTemplate,
            title: "Action",
        },
    ]
});
 
 
function createActionTemplate(dataItem: any): any {
    if(dataItem.Status == "SUCCESS")
        return kendo.template($("#action-template1").html());
    else
        return kendo.template($("#action-template2").html());
}
Alexander Valchev
Telerik team
 answered on 05 Sep 2014
1 answer
281 views
I can get AngularJS data show correctly in kendo popup window.  But when I change the controller and scope data, it still show the old data. I use alert and found the scope data is correct before showing the popup window.  I want to share the same popup kendo window across different controller as their interface are the same.  What did I miss?

​ function popupMonths() {
       $scope.$apply();
      alert($scope.selectedItemName);             <<< correct data show in here
      $("#winAddMths").kendoWindow({
            width: "430px",
            height: "200px",
            modal: true,
            draggable: true,
            resizable: false,
            title: "Apply to Selected Months"
     });
     $("#winAddMths").data("kendoWindow").center().open();    <<< open but with previous data
}
Alex Gyoshev
Telerik team
 answered on 05 Sep 2014
1 answer
75 views
Hi there,


I am trying to use my search for with a 'search' button to search the grid i have in place. The grid can be search on one textbox having information supplied or many, each of the textboxes relate to a column within the grid. Could someone please help me on how to do this? I tried to use the example for (http://demos.telerik.com/kendo-ui/grid/toolbar-template ) but this uses a toolbar templete and i would like to keep my search form as it stands but only search the form when the button for search is clicked. 

Any help would be very much appreicated as i have spent a while trying to figure this issue out.

Thanks



    <div class="container">
        <hr />
        <div class="form-group row">
            <label class="col-md-2 control-label">Fee Earner:</label>
            <div class="col-md-10">
                <input class="form-control" id="searchFeeEarner" />
            </div>
        </div>
        <div class="form-group row">
            <label class="col-md-2 control-label">Matter Number:</label>
            <div class="col-md-10">
                <input class="form-control" id="searchMatterNumber" />
            </div>
        </div>
        <div class="form-group row">
            <label class="col-md-2 control-label">Start Date:</label>
            <div class="col-md-10">
                <input class="" id="searchStartDate" />
            </div>
        </div>
        <div class="form-group row">
            <label class="col-md-2 control-label">End Date:</label>
            <div class="col-md-10">
                <input id="searchEndDate" />
            </div>
        </div>
        <div class="form-group row">
            <label class="col-md-2 control-label">Template Name:</label>
            <div class="col-md-10">
                <input id="searchTemplateName" class="form-control" />
            </div>
        </div>
 
        <div class="row">
            <div class="col-md-12">
                <button id="search" class="btn btn-default">Search</button>
                <button id="clear" class="btn btn-default">Clear</button>
            </div>
        </div>
        <div class="row" style="padding-top: 20px">
            <div class="col-md-12">
                <div id="sessionGrid"></div>
            </div>
        </div>
    </div>
<script>
    // jQuery on DOM ready function
    $(function () {
 
        // create a remote kendo Data Source pointing to Web API
        // session controller. Currently handles Get (read) and Post (create)
        // Schema / model has been set in order to support better behavior
        // on the grid.
        var sessionDataSource = new kendo.data.DataSource({
            transport: {
                read: {
                    url: "/api/Session/Get",
                    dataType: "json"
                },
                create: {
                    url: "/api/Session/Post",
                    type: "POST"
                }
            },
            pageSize: 10,
            schema: {
                model: {
                    id: "Id",
                    fields: {
                        Id: { type: "number", editable: false, nullable: false, visible: false },
                        SessionId: { editable: false, nullable: true },
                        NetworkId: { type: "string" },
                        Comments: { type: "string" }
                    }
                }
            }
        });
 
        // Initialise a Kendo Grid on the div container,
        // using the data source created above.
        // Also adds a create toolbar and the columns
        $("#sessionGrid").kendoGrid({
            dataSource: sessionDataSource,
            pageable: true,
            editable: false,
            columns: [
            { field: "Matter", title: "Matter No." },
            { field: "NetworkId", title: "User Name" },
            { field: "TemplateName", title: "Template Name" },
            { field: "Comments", title: "Comments" },
            { command: [
                { name: "RecreateDocument", text: "Recreate Document", click: recreateDocument, width: "180px"  }]
            }]
        });
           
       
        function recreateDocument(e) {
            e.preventDefault();
            var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
            window.location = "api/Session/RecreateDocument/" + dataItem.SessionId;
 
 
            //$.ajax({
            //    type: "GET",
            //    url: "api/Session/RecreateDocument/" + dataItem.SessionId,
            //    //contentType: "application/json; charset=utf-8",
            //    //data: JSON.stringify( { sessionId : dataItem.SessionId} )
            //}).done(function (msg) {
            //    window.open(msg.d);
            //    alert("Document(" + dataItem.SessionId + ")" + "Recreated");
            //});
        }
 
        //Autocomplete FeeEarner
 
        $("#searchFeeEarner").kendoAutoComplete({
            dataSource: EmployeeDirectoryACDataSource,
            dataTextField: 'FullName',
            filter: "startswith",
            placeholder: "Search...",
            minLength: 3,
            suggest: true
        });
 
 
        //$("#searchFeeEarner").kendoAutoComplete({
        //    dataSource: sessionDataSource,
        //    dataTextField: 'NetworkId',
        //    dataValueField: 'NetworkId',
        //    filter: "startswith",
        //    minLength: 4
        //});
 
 
 
        //Autocomplete MatterNumber
 
        $("#searchMatterNumber").kendoAutoComplete({
            dataSource: AderantDataSource,
            dataTextField: 'MatterCode',
            filter: "startswith",
            placeholder: "Matter...",
            minLength: 4,
            suggest: true
        });
 
        //Picker Start Date
        $(document).ready(function () {
            $("#searchStartDate").kendoDatePicker({ format: "dd/MM/yyyy" });
        });
 
        //Picker End Date
        $(document).ready(function () {
            $("#searchEndDate").kendoDatePicker({ format: "dd/MM/yyyy" });
        });
 
        //Autocomplete TemplateName
        $("#searchTemplateName").kendoAutoComplete({
            dataSource: sessionDataSource,
            dataTextField: 'TemplateName',
            filter: "contains",
            placeholder: "Search..."
        });
 
        $("#searchButton").on('click', function () {
            var value = this.value();
            if (value) {
                grid.data("#sessionGrid").dataSource.filter({ field: "Matter", operator: "eq", value: parseInt(value) });
            } else {
                grid.data("#sessionGrid").dataSource.filter({});
            }
        });
 
 
        //Clear AutoComplete
        $('#clear').click(function (e) {
            e.preventDefault();
            autoComplete.data("kendoAutoComplete").value('');
            ds.filter({});
        });
 
   
    })
</script>



Nikolay Rusev
Telerik team
 answered on 05 Sep 2014
7 answers
1.1K+ views
I need to call web api with basic authentication  inside trasport section of datasource, is it possible and how?
In detail, my api controller could retrieve from a third source just a page of datas so i need to use server pagination for grid values and pass the page i need, the only way to link to pagination mechanism is just to call directly the json web api, but i need to add basic+credentials to header. I'm working with angular and for http$ i iniect credential in header automatically, but i don't think it could work with transport in datasource. Any help? thanks in advance.
Daniel
Telerik team
 answered on 05 Sep 2014
2 answers
139 views
Like the title says. :)
The problem is that when getting selected value only first value is returned not array of all values.
Steps to reproduce: Add 2 items to both (normal and inherited) multiselect and carefully watch console. Multiselect returns array, but inherited multiselect returns only object of the first selected item.

dojo example
Matjaz
Top achievements
Rank 1
 answered on 05 Sep 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
Drag and Drop
Application
Map
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
DropDownTree
ListBox
PDFViewer
Sparkline
ActionSheet
TileLayout
PopOver (Mobile)
TreeMap
ButtonGroup
Styling
ColorPicker
Pager
Chat
MultiColumnComboBox
Dialog
DateRangePicker
Checkbox
Timeline
Drawer
DateInput
ProgressBar
MediaPlayer
ImageEditor
TextBox
OrgChart
Accessibility
Effects
Licensing
PivotGridV2
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
LLM Kit
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?