Telerik Forums
Kendo UI for jQuery Forum
1 answer
149 views
I have an error dialog window I need to open where the content is the result of a Http/REST error from the server.  How do I set the content of the body of the window dynamically?
Petur Subev
Telerik team
 answered on 21 Aug 2014
3 answers
267 views
Hi,

I'm trying to bind a MultiSelect with Angular JS using k-ng-model. It seems to work when I select elements, but not when displaying the control (nothing is pre-selected).

Code from Angular controller:
$scope.selectOptions = {
        placeholder: "Select roles...",
        dataTextField: "roleName",
        autoBind: false,
        dataSource: $scope.roles,
         
select: function(e) {
console.log("Event: "+e.item);
}
    };


HTML:
<div data-kendo-multi-select
data-k-options="selectOptions"
data-k-ng-model="user.roles"
style="width: 300px">


Georgi Krustev
Telerik team
 answered on 21 Aug 2014
1 answer
188 views
I am exploring the Kendo UI Gantt chart to fulfill a requirement in my application, to allow users to drop events (tasks) onto a chart for planning purposes.  Two questions I was hoping for some feedback on would be - 

1 - Is it possible to explicitly set a start and end date for the Gantt chart?  For instance, could I specify that the Gantt should show the current month, through 6 months into the future, regardless of any tasks being assigned to a date in the future?

2 - Is it reasonable to think that I can manually initialize a new task in the chart, via dragging and dropping an object from outside the Gantt, into the viewable Gantt area?

Alex Gyoshev
Telerik team
 answered on 21 Aug 2014
8 answers
1.4K+ views
Hi,

I'm building off the KendoGrid "inline editing" demo. I want the destroy url to be simply:

/api/company/delete/id ( for example, /api/company/delete/17 )

What I'm getting is the URL I specified with the querystring '?id=17' appended

/api/company/delete?id=17

So how do I get the request in REST format instead of URI format?

Many thanks in advance,

Robert

Here's my code:
$(document).ready(function() {
       var dataSource = new kendo.data.DataSource({
           transport: {
               read:  {
                   url: "/api/company/get",
                   dataType: "json"
               },
               destroy: {
                   url: "/api/company/delete",
                   dataType: "json"
               },
               parameterMap: function(options, operation) {
                   if (operation !== "read" && options.models) {
                       return {models: kendo.stringify(options.models[0].id)};
                   }
               }
           },
           batch: true,
           pageSize: 20,
           schema: {
               model: {
                   id: "id",
                   fields: {
                       id: { type: "number" },
                       name: { type: "string" },
                       admin_id: { type: "number" },
                       address_id: { type: "number" },
                       status_msg: { type: "string" }
                   }
               }
           }
       });
});
 
ian
Top achievements
Rank 1
 answered on 21 Aug 2014
1 answer
227 views
Hi Guys,

I need you help on the problem that I'm encountering right now. I'm using Kendo I grid with Hierarchy and I have two date picker and button which is not part of the Grid (Please refer to the attachment grid.png). What I want to do is, when the "Update Date" button is clicked, the Period Start and Period End dates will be updated by what ever is selected in the datepicker outside the grid. All the data of all the child is more than 1,000 records. My current code is working, I was able to update all the data of all the child grid. The only problem is, the internet browser is not respoding due to a long running script. I expecting this process to be quick since I'm just only updating the data locally. Do you know a work around for this? Please see my code implementation below.

Grid initialization:

01.var grid = $("#gridJobsH");
02. 
03.grid.kendoGrid({
04.    dataSource: dataSource
05.    , columns: [               
06.        { field: 'HasSAPAccrualsTop', title: " ", template: '<span class="AccrualStatus-#= HasSAPAccrualsTop #"></span>', width: 50, filterable:false, sortable: false}            
07.        ,{ field: 'CommitmentCode', title: 'Purchase Order'}
08.        ,{ field: 'CommitmentSeller', title: 'Subcontractor'}                  
09.    ]
10.    , sortable: true
11.    , reorderable: true
12.    , groupable: false
13.    , filterable: true
14.    , columnMenu: true
15.    , selectable: false
16.    , pageable: false
17.    , resizable: true
18.    , scrollable: {
19.        virtual: true
20.    }
21.    , detailInit: detailInit
22.    , toolbar: [
23.        { template: kendo.template($("#gridJobsHToolbarTemplate").html()) }
24.     ]
25.});

Detail Grid:

01.//Detail grid
02.function detailInit(e) {
03.    $('<div class="hdChildGrid"></div>').appendTo(e.detailCell).kendoGrid({
04.        dataSource: {
05.            data: gridDetails
06.            , autoSync: false
07.            , schema: {
08.                model: {
09.                    id: "PhaseCode"
10.                    ,fields: {                             
11.                        HasSAPAccruals:{ editable: false }
12.                        ,PhaseCode: { editable: false }
13.                        ,Description: { editable: false }
14.                        ,PeriodStart: { editable: true, type: "date" }
15.                        ,PeriodEnd: { editable: true, type: "date" }
16.                        ,CommittedCost: { editable: false }
17.                        ,TotalCostActual: { editable: false }
18.                        ,Accruals: { editable: false }
19.                        ,Incurred: { editable: false, type: "number"  }
20.                        ,CurrentSAPValue: { type: "number" }
21.                        ,SAPAccrualValue: { type: "number"  }
22.                    }
23.                }
24.            }
25.            , filter: { field: "CommitmentCode", operator: "eq", value: e.data.CommitmentCode }
26.        }
27.        , columns: [   
28.            { field: 'HasSAPAccruals', title: " ", template: '<span class="AccrualStatus-#= HasSAPAccruals #"></span>', width: 50, filterable:false, sortable: false, locked: true, lockable: false}
29.            ,{ field: "PhaseCode", title: "Phase Code",  width: 150, locked: true, lockable: false }
30.            ,{ field: "Description", title: "Description", width: 150 }
31.            ,{ field: "PeriodStart", title: "Period Start", width: 150, format:"{0:MM-dd-yyyy}"}
32.            ,{ field: "PeriodEnd", title: "Period End", width: 150, format:"{0:MM-dd-yyyy}"}
33.            ,{ field: "CommittedCost", title: "PO Value", width: 110, type: "number", format: "{0:c}" }
34.            ,{ field: "TotalCostActual", title: "Expenditures", width: 130, type: "number" , format: "{0:c}"}
35.            ,{ field: "Accruals", title: "Accruals", width: 100, type: "number" , format: "{0:c}" }
36.            ,{ field: "Incurred", title: "Incurred", width: 100, format: "{0:c}" }
37.            ,{ field: "CurrentSAPValue", title: "Current SAP Value", width: 170, format: "{0:c}"}
38.            ,{
39.                field: "SAPAccrualValue"
40.                ,title: "SAP Accrual Value"
41.                ,width: 170
42.                ,format: "{0:c}"
43.                ,lockable: false
44.                ,editor: function(cont, options) {
45.                    var amt;
46.                     
47.                    kendo.culture("en-US");
48.                    amt = kendo.toString(options.model.CurrentSAPValue, "c");
49.                     
50.                    $("<span>" + amt + "</span>").appendTo(cont);
51.                }
52.            }
53.        ]
54.        , scrollable: true
55.        , sortable: true
56.        , filterable: true
57.        , columnMenu: true 
58.        , editable: true
59.        , resizable: true
60.        , selectable: "multiple"
61.        , save: function(d) {
62.            if (d.values.CurrentSAPValue) {
63.                d.model.set("SAPAccrualValue", d.model.Incurred - d.values.CurrentSAPValue);
64.                d.model.set('Dirty',true);
65.            }          
66.        }
67.    });
68.}

Button event:

01.var btnUpdateDate = $('#btnUpdateAllDate')
02.    ,infoDialog = $('#infoDialog')
03.    ,btnInfoOK = $("#btnInfoOK").data("kendoButton")
04.    ,infoDialogMsg = $('#infoDialogMsg');  
05.     
06.start = $("#StartDate").kendoDatePicker({value: new Date()}).data("kendoDatePicker");
07. 
08.end = $("#EndDate").kendoDatePicker({value: new Date()}).data("kendoDatePicker");
09. 
10.btnUpdateDate.kendoButton({
11.    click: function(e) {
12.        var startDate = start.value()
13.            ,endDate = end.value()
14.            ,parentGrid = $('#gridJobsH').data("kendoGrid")
15.            ,child = $('.k-detail-row').find('td.k-detail-cell').find('div.k-grid').data("kendoGrid");             
16.             
17.        if(endDate < startDate ) {
18.            infoDialogMsg.html('End date must be ahead to Start date.');
19.            infoDialog.data("kendoWindow").open();
20.        } else {
21.         
22.            var chilEl = $('.hdChildGrid')
23.                ,childGrid = $(chilEl[0]).data('kendoGrid');                   
24.                 
25.            if(childGrid != null) {
26.                var dataSource = childGrid.dataSource;
27.                 
28.                dataSource.fetch(function() {
29.                    var models = dataSource.data()
30.                      ,modelsLength = models.length;
31. 
32.                    for (var i = 0; i < modelsLength; i++) {
33.                        var m = models[i];
34. 
35.                        m.set('PeriodStart', startDate);
36.                        m.set('PeriodEnd', endDate);
37.                    }                   
38.                });
39.            }
40.        }      
41.    }
42.});

Your idea is highly appreciated.

Thanks
Alexander Valchev
Telerik team
 answered on 21 Aug 2014
1 answer
175 views
Hi, when adding a Kendo button to a notification template, the generated <script> tags are overlapping and causing the notification window to fail.  Am I missing something or is this a bug?  I'm about to give up and try the Kendo window control.

HTML
<script id="reportTemplate" type="text/x-kendo-template">
    <div style="height:100px; width:300px;border:thin solid black;">
        <h3><img src="/Content/Images/SuccessfulSaveTickMark.png" alt="" />#= title #</h3>
        <p>
            @Html.LabelFor(m => m.NotificationText)
        </p>
        <p>
            @(Html.Kendo().Button()
                .Name("viewNowButton")
                .HtmlAttributes(new { type = "button", onclick = "javascript:validateSession()" })
                .Content("View Now")
            )
            @(Html.Kendo().Button()
                .Name("viewLaterButton")
                        .HtmlAttributes(new { type = "button", onclick = "javascript:validateSession()" })
                .Content("View Later")
            )
            @(Html.Kendo().Button()
                .Name("downloadButton")
                        .HtmlAttributes(new { type = "button", onclick = "javascript:validateSession()" })
                .Content("Download")
            )
        </p>
        <p>
            @(Html.Kendo().Button()
                .Name("redirectToReportPickupButton")
                .HtmlAttributes(new { type = "button", onclick = "javascript:validateSession()" })
                .Content("Go to Report Pick Up Page")
            )
        </p>
    </div>
</script>


Output
​
<script id="reportTemplate" type="text/x-kendo-template">
    <div style="height:100px; width:300px;border:thin solid black;">
        <h3><img src="/Content/Images/SuccessfulSaveTickMark.png" alt="" />#= title #</h3>
        <p>
            <label for="NotificationText">NotificationText</label>
        </p>
        <p>
            <button id="viewNowButton" onclick="javascript:validateSession()" type="button">View Now</button><script>
    jQuery(function(){jQuery("#viewNowButton").kendoButton({});});
</script>
            <button id="viewLaterButton" onclick="javascript:validateSession()" type="button">View Later</button><script>
    jQuery(function(){jQuery("#viewLaterButton").kendoButton({});});
</script>
            <button id="downloadButton" onclick="javascript:validateSession()" type="button">Download</button><script>
    jQuery(function(){jQuery("#downloadButton").kendoButton({});});
</script>
        </p>
        <p>
            <button id="redirectToReportPickupButton" onclick="javascript:validateSession()" type="button">Go to Report Pick Up Page</button><script>
    jQuery(function(){jQuery("#redirectToReportPickupButton").kendoButton({});});
</script>
        </p>
    </div>
</script>
Dimo
Telerik team
 answered on 21 Aug 2014
7 answers
1.2K+ views
I have a graph in Kendo with positive values. The problem is that the Y-axes takes his range in function of the values.E.g. minimum value is 5000 -> the y-axis starts from 4500.Is there a way to get the y-axis fixed on 0? So it always starts from 0 instead of a narrower range. I found that you can put the min on 0 in ValuesAxis, but the problem here is that I can't get any negative values in this way.

My code:
$scope.line = {<br>        cache:false,<br>        legend: {<br>            visible: false<br>        },<br>        title: {<br>            text: "Last 10"<br>        },<br>        series: [{<br>            type: "line",<br>            style: "smooth",<br>            field: "OBAmount",<br>            categoryField: "date",<br>            color: '#0c50dd'<br>        }],<br>        valueAxis: {<br>            line: {<br>                visible: false<br>            }<br>        },<br>        tooltip: {<br>            visible: true,<br>            template: "#= kendo.format('{0:n2}', value) # "<br>        }<br>    }
T. Tsonev
Telerik team
 answered on 21 Aug 2014
1 answer
689 views
I want the following behaviour of the grid height like in this Fiddle: http://jsfiddle.net/dimodi/SDFsz/
but then also calculate the maximal possible rows on the screen without showing the scrollbar everythime the user changes the browser height. So our users can easily go with pageUp and pageDown through the gird.

And change the first value on the pageSize dropdown to 'Fit'.

Is it possible to make a directive in AngularJS that can do this behaviour?
Dimo
Telerik team
 answered on 21 Aug 2014
1 answer
145 views
[English]
I'm applying the template jFlatu to my project, before already had views and routers working under Kendo SPA. But now, applying the template jFLatu, it gives me an error of GET, where tries to bring the file jQuery and not Kendo, to check the console, seems that jQuery Mobile the problem is.
If I put jQuery Mobile with comments, everything works, and Kendo does what he has to do, but I need jQuery Mobile for the operation of the template.

[Spanish]
Estoy aplicando la plantilla jFlatu a mi proyecto, que ya tenia las vistas y routers funcionando bajo Kendo SPA. Pero me da un error de GET, donde jQuery intenta traer el archivo y no Kendo, al revisar la consola parace que es jQuery Mobile el problema.
Si pongo jQuery Mobile con comentarios, todo funciona y Kendo hace lo que tiene que hacer, pero necesito jQuery Mobile para el funcionamiento de la plantilla.

<head>
        <script type="text/javascript" src="cordova.js"></script>
        <script type="text/javascript" src="kendo/js/jquery.min.js"></script>
        <!--<script src="js/libs/jquery.mobile-1.3.0.min.js"></script>-->
        <script type="text/javascript" src="kendo/js/kendo.all.min.js"></script>
<script src="assets/flex-slider/jquery.flexslider-min.js"></script>
</head>

<body>
        <div id='app'></div>

        <script type="text/x-kendo-template" id="indexTemplate">
            <article>
                <header>
                    <h1>Citizen Connected</h1>
                    <h2>Inicio De Sesión</h2>

                    <!-- Login -->
            <!--
                    <div id="logged-in">
                        Bienvenido, <span id="login-name"></span>.
                        <button id="log-out">Cerrar Sesión</button>
                    </div>
            -->
                    
                    <div id="logged-out">
                        Puedes iniciar sesión con:
                        <button id="buttonFacebook">Facebook</button>
                        <button id="buttonTwitter">Twitter</button>
                    </div>
                    <!-- End FB Login-->

                    <form id='add-item'>
                        <button type='submit' id='refresh'>Actualizar</button>
                        <button type='submit'>Añadir</button>
                        <div><input type='text' id='new-item-text' placeholder='Ingresa una denuncia.' /></div>
                    </form>
                </header>
                
                <ul id='todo-items'></ul>
                <p id='summary'>Cargando...</p>
            </article>

            <footer>
                <ul id='errorlog'></ul>
            </footer>
        </script>

        <script type="text/x-kendo-template" id="reportarTemplate">
        <!-- page -->
        <div data-role="page" data-theme="a">
            
            <!-- sideNavigationPanel -->
            <div data-role="panel" id="sideNav" data-position="left">
                <ul id="sideButtons">
                    <li><a href="https://www.facebook.com/pages/Citizen-Connected/255467614605481"><i class="icon-facebook"></i></a></li>
                    <li><a href="https://twitter.com/CitizenConnecte"><i class="icon-twitter"></i></a></li>
                    <li><a href="https://www.facebook.com/PeterConchaR"><i class="icon-facebook"></i></a></li>
                    <li><a href="https://twitter.com/PeterConchaR"><i class="icon-twitter"></i></a></li>
                </ul>
                <ul id="sidePanel" class="clleft">
                    <li id="active"><a href="#"><i class="icon-home"></i>Inicio</a></li>
                    <li><a href="about.html"><i class="icon-lightbulb"></i>Sobre CC</a></li>
                    <li><a href="contact.html"><i class="icon-envelope"></i>Contáctanos</a></li>
                </ul>
            </div>
            <!-- /sideNavigationP -->
            
            <!-- header -->
            <div data-role="header" data-position="fixed">
                <h1>Citizen Connected</h1>
                <a href="#sideNav" id="navIcon"><i class="icon-th-list"></i></a>
            </div>
            <!-- /header -->
    
            <!-- content -->
            <div data-role="content">

                <div id="logged-in">
                    Bienvenido, <span id="login-name"></span>.
                    <button id="log-out">Cerrar Sesión</button>
                </div>
          
                <!-- slogan  -->
                <div class="ui-grid-solo">
                    <h1 class="intro">Registra tu denuncia</h1>
                    <!-- Mapa -->
                    <div id="map_canvas" style="width: 290px; height: 200px;"></div>    
                    <a href="#" onclick="checkIn()" data-role="button" class="btn swatch-2">Check In</a>
                </div>
                <!-- /slogan -->
      
                <hr/>
                
                <!-- footer -->
                <div class="footer text-center">
                  <p>COPYRIGHT 2013 Universidad de Guayaquil</p>
                </div>
                <!-- /footer-->
            </div>
            <!-- End Content -->
        </div>
        <!-- /page -->

        </script>

        <script type="text/x-kendo-template" id="layoutTemplate">

        </script>

        <script>
            // Views
            var indexView = new kendo.View("indexTemplate");
            var reportarView = new kendo.View("reportarTemplate");

            // Routers
            var router = new kendo.Router();

            router.route("/", function () {
                indexView.render("#app");
            });

            router.route("/reportar", function () {
                reportarView.render("#app");
            });

            $(function () {
                router.start();
            });
        </script>

        <!-- Google Maps API -->
        <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?sensor=true"></script>

        <script type="text/javascript" src="js/index.js"></script>

        <script type="text/javascript" src="js/libs/MobileServices.Web-1.1.0.min.js"></script>
        <script type="text/javascript">
            app.initialize();
        </script>
    </body>
Petyo
Telerik team
 answered on 20 Aug 2014
1 answer
141 views
Here is a simplified version of my code (there is nothing in the <table>):

var _manu = [{"text":"Acme","value":1},{"text":"Other","value":2}];
 
function getManufacturerName(id) {
        for (var i = 0; i < _manu.length; i++) {
            if (_manu[i].value == id) { return _manu[i].text; }
        }
        return '';
    }
 
gridDataSource = new kendo.data.DataSource({
                batch: true,
                transport: {
                    read: { url: 'myUrl' },
                },
                schema: {
                    model: {
                        id:"ItemId",
                        fields: {
                            ManuId: { type: "number" }
                        }
                    }
                }
           });
 
var kendoGrid = gridObj.kendoGrid({
                dataSource: gridDataSource,
                selectable: "row",
                editable: true,
                columns: [
                    {
                        field: "ManuId",
                        title: "Manufacturer",
                        editor: manufacturerDropDownEditor,
                        template:"#= getManufacturerName(ManufacturerId) #"
                    }
                ]
            }).data('kendoGrid');
 
 
function manufacturerDropDownEditor(container, options) {
            $('<input data-bind="value:' + options.field + '"/>')
                .appendTo(container)
                .kendoDropDownList({
                    dataTextField: "text",
                    dataValueField: "value",
                    dataSource: _manu
                });
        }

And everything works fine, except that when I use the dropdown to change the value, it never changes in the datasource.  My change even never fired (I cut it out of here) and if I try to update, the field edited by the dropdown is not changed.  THe other fields (there are text fields, number fields, etc. in the none abbreviated code) all fire the change event and show up in the datasource.  Any idea why this isn't changing anything?
Stan
Top achievements
Rank 1
 answered on 20 Aug 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
MultiColumnComboBox
Chat
DateRangePicker
Dialog
Checkbox
Timeline
Drawer
DateInput
ProgressBar
MediaPlayer
ImageEditor
TextBox
OrgChart
Effects
Accessibility
PivotGridV2
ScrollView
BulletChart
Licensing
QRCode
ResponsivePanel
Switch
Wizard
CheckBoxGroup
TextArea
Barcode
Breadcrumb
Collapsible
Localization
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
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?