Telerik Forums
Kendo UI for jQuery Forum
4 answers
231 views
Hi guys.
Kendo UI for ASP.NET MVC 2014.2.903 has broken my application down. You seem to miss  
"result = $(element).data("kendo" + widget.fn.options.prefix + widget.fn.options.name);"  in new version.
So, in the bottom of kendo.init you do not initialize anything.

Petyo
Telerik team
 answered on 08 Sep 2014
3 answers
593 views
Hello,

I am trying to get the record count of the grid using "grid.dataSource.total()", but it is always returning zero.

This is an AngularJS app with an itemDetailsDirective that is used to display detail about an item.  It is a pop-up window that contains a grid with inventory on-hand, etc. for the various locations.  However, when no locations have inventory, the grid is displayed with only the headers, which looks funny and I would like to only display the grid if there are records to display, and display some text like, "No inventory found for this item" instead of the grid when it is empty.

Here is the directive:
(function () {
    'use strict';
    angular.module('app').directive('itemDetails', itemDetailsDirective);
 
    function itemDetailsDirective() {
        return {
            restrict: 'E',
            scope: {
                itemNo: "@",
            },
            templateUrl: "/app/inventory/itemDetails.html",
            controller: function ($scope, $element) {
                console.log("itemDetailsDirective, controller: " + $scope.itemNo);
 
                $scope.$on('ShowDetails', function (event, itemNo) {
                    console.log("itemDetailsDirective, ShowDetails: " + itemNo);
                     
                    $scope.itemNo = itemNo;
                    $scope.inventoryGridOptions = getInventoryGridOptions();
                    $scope.inventoryGrid.setDataSource(getGridDataSource(itemNo));
                    $scope.inventoryGrid.dataSource.read();
                    $scope.gridRecordCount = $scope.inventoryGrid.dataSource.total();
                    $scope.inventoryGrid.refresh();
                    $scope.itemDetailsWindow.center();
                    $scope.itemDetailsWindow.open();
                });
 
                $scope.onGridDataBound = function(e) {
                    if ($scope.inventoryGrid) {
                        $scope.gridRecordCount = $scope.inventoryGrid.dataSource.total();
                    }
                }
 
                $scope.close = function() {
                    $scope.itemDetailsWindow.close();
                }
            }
        };
 
        function getGridDataSource(itemNo) {
            console.log("itemDetailsDirective, getGridDataSource: " + itemNo);
 
            return new kendo.data.DataSource({
                type: "json",
                transport: {
                    read: {
                        url: "/api/Inventory/GetInventory?itemNo=" + itemNo,
                        type: "GET",
                        cache: false
                    }
                },
                sort: [{ field: "Loc", dir: "asc" }],
                pageSize: 10
            });
        }
 
        function getInventoryGridOptions() {
            return {
                scrollable: false,
                columns: [
                    {
                        field: "Loc", title: "Loc", width: 50,
                    },
                    {
                        field: "QtyOnHand", title: "Qty OnHand", width: 70, format: "{0:n0}", attributes: { style: "text-align:right" }
                    },
                    {
                        field: "QtyCom", title: "Qty Com", width: 50, format: "{0:n0}", attributes: { style: "text-align:right" }
                    },
                    {
                        field: "QtyBO", title: "Qty BO", width: 50, format: "{0:n0}", attributes: { style: "text-align:right" }
                    },
                    {
                        field: "QtyXfer", title: "Qty Xfer", width: 50, format: "{0:n0}", attributes: { style: "text-align:right" }
                    },
                    {
                        field: "QtyOrd", title: "Qty Ord", width: 50, format: "{0:n0}", attributes: { style: "text-align:right" }
                    }
                ]
            };
        };
    };
})();

How can I get the record count of the grid / data source?

Also, please let me know if you have other recommendations for displaying something alternate when the grid is empty.

Thanks,
Lars


Lars
Top achievements
Rank 1
 answered on 07 Sep 2014
8 answers
456 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
179 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
129 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
465 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
590 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
270 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
71 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
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
Drag and Drop
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
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
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?