Telerik Forums
Kendo UI for jQuery Forum
0 answers
296 views
Hi everyone,



I am developing a single page application with Kendo UI. Since many widgets append some HTML to the <Body> the Memory consumption grows quickly when using the application (even if the widgets are no longer part of the application, e.g. closed).



To work around this, I usually remove any direct descendants of the <Body> upon unloading certain parts of my application. While this works great so far, I'm currently struggling to get the date picker widget working with this technique.



The Problem is that the date picker works fine when the application initializes it for the very first time, but after removing that date picker and creating another one some time later it won't work as intended. The Dropdown calendar is displayed but None of the links or Buttons react to clicks except for the current date on the bottom of the calendar.



Is there a way to get this working? Like I said, other widgets like Dropdown lists and Windows just work fine with my "garbage collection".



Here's a demo of the issue: http://jsfiddle.net/zwGyM/1/



Regards
Majid
Top achievements
Rank 1
 asked on 11 Sep 2012
0 answers
358 views
Hi, I am using KendoMobileListView and I want to know how I can get the index of selected Item. My DataSource contains multiple entries and I want to be able to find out the index of selected item to show appropriate data

$('#Template').kendoMobileListView({       
        dataSource: EmployeeVisitsInfo,
        template: '<table  style="width: 100%"><tr><td><p>${a = (typeof data.Name !== "undefined") ?Name : data.LastName</td></table>',
        click:  function(e){
          var datasource = $('#Template').data("kendoMobileListView");
          var index = datasource .select().index();
          var dataItem = ds.dataSource.view()[index];
          console.log(index)
        }
    });

I dont think this is the right way to get the index of selected item because i am keep getting and error saying :

Uncaught TypeError: Object [object Object] has no method 'select'  

Any Idea how I can go about doing this ? Thank you
Pourya
Top achievements
Rank 1
 asked on 11 Sep 2012
1 answer
191 views
Following issue: MVVM model contains groups array, for each group we create a DIV with some information (fields) using source binding and data-template attribute. Each div contains a button, which is suppose to be a mobile button, but it does not render as a mobile button. I simplified my example - each div has simply a button:

<div id="test" data-role="view" data-model="viewModel">
    <div data-bind="source:groups" data-template="groupsTemplate"></div>
    <button data-role="button" data-bind="click:buttonClick">Add new Button</button>
</div>
<script id="groupsTemplate" type="text/x-kendo-template">
    <button data-role="button" data-bind="text:caption"></button>
</script>
and a viewModel:
var viewModel = kendo.observable({
    caption: "buttons",
    groups:[
        {name:"button1", caption:"First", error:""},
        {name:"button2", caption:"Second", error:""},
        {name:"button3", caption:"Third", error:""}
    ],
    buttonClick: function(){
        this.groups.push({name:"button4", caption:"Forth", error:""});
    }
});
//kendo.bind($('#test'), viewModel);
new kendo.mobile.Application();​


the result is: http://jsfiddle.net/S7edM/2/ 

Of course if I uncomment line with kendo.bind, and remove data-model attribute from root div it renders correctly, since it created mobile application on already existing DOM, but if I need to add a new button, it does not renders to mobile button.

General question: If I have different mobile components like switch, list view etc. in such "groups", which are added and removed through templates and view model, do I have any "afterAdd" and "beforeRemove" events, and is there any kendo mobile method to init newly created DOM elements? 
Petyo
Telerik team
 answered on 11 Sep 2012
1 answer
152 views
Hi Guys,

I am new to Kendo and was able to get the List on JSp in grid format but when I click on edit button, I am able to edit the data on JSP but when I click on Update , I am not able to update in database, I just want to get the data back to action class, so that I can atleast update them using JAVA code.

The only problem is with transport I guess, I dont know how to pass the URL.
Please give me a small example of code snippet how to pass control in URL if possible.

Help appreciated.

Thanks and regards,
Nitesh
Atanas Korchev
Telerik team
 answered on 11 Sep 2012
1 answer
91 views
Hello,



Hovering over a label tag which is linked to an input widgets does not work. The k-state-hover class is not applied.

Focussing does work.



Regards, Jaap
Dimo
Telerik team
 answered on 11 Sep 2012
1 answer
320 views
I've got a tabstrip that gets data via an ajax call and loads a grid when a user clicks on the tab.  While the tab is open, the user can upload a new file.  In the success event of the Upload widget I want to reload the grid with the newly uploaded item shown on the list.  How can I find the tab, then simulate the tab click to execute the event handler?



Thanks



Alexander Valchev
Telerik team
 answered on 11 Sep 2012
0 answers
174 views
HI,
    I'm using the listview to act as a form in the same way you have in your demo's. I would like to be able to add some items dynamically to the end of the listview based on some code logic. Because this is not using a datasource as all the common items are declared in html code at designtime, how would I go about adding the extra non common items to listview.items() at runtime. 

Or I could use a dataSource but then how can I specify what template each item should have when they would not all want the same template.

Thanks 
Paul
Top achievements
Rank 1
 asked on 11 Sep 2012
1 answer
243 views
What is different between kendo.default.less and kendo.default.css? And also how to use .less file in html-jquery application?
Dimo
Telerik team
 answered on 11 Sep 2012
7 answers
306 views
I am getting following error multiple time while I am generating Line Chart for more than 100 items.

A script on this page is causing your web browser to run slowly. If it continues to run, your computer might become unresponsive.

ASPX Page

<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeBehind="Default.aspx.cs" Inherits="KendoUIDemo._Default" %>


<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
    <script src="Scripts/jquery.min.js" type="text/javascript"></script>
    <script src="Scripts/kendo.dataviz.min.js" type="text/javascript"></script>
    <script src="Scripts/console.js" type="text/javascript"></script>
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">


    <div id="example" class="k-content" >
        <div class="chart-wrapper">
            <div id="chart" >
            </div>
        </div>
    </div>
    Random Data:
    <asp:TextBox ID="txtNo" runat="server" Text="10" />
    <asp:Button runat="server" ID="btnData" Text="Get Data" /><br />
    <asp:TextBox ID="txtSerializeData" runat="server" Text="10" ClientIDMode="Static" />


    <br />
    <input type="button" onclick="createChart();" value="Visualize" />
    <asp:DataGrid ID="gvData" runat="server" AutoGenerateColumns="false">
        <Columns>
            <asp:BoundColumn DataField="Date" HeaderText="Date" DataFormatString="{0:MM/dd}" />
            <asp:BoundColumn DataField="onCR" HeaderText="onCR" DataFormatString="{0:f2}" />
            <asp:BoundColumn DataField="offCR" HeaderText="offCR" DataFormatString="{0:f2}" />
        </Columns>
    </asp:DataGrid>
    <script type="text/javascript">


        function getArray() {


            return [15.7, 16.7, 20, 23.5, 26.6];


        }


        function getDatafromGrid(grid, columnIndex) {
            var t = "";


            $(grid + " tr:has(td)").each(function () {
                var col = $(this).find("td")
                t = t + $(col[columnIndex]).html() + ", ";
            });




            return t.substring(t.indexOf(",") + 1, t.lastIndexOf(",")).split(",");


        }








        function createChart() {


            var w = getDatafromGrid("#<%= gvData.ClientID %>", 0).length * 40;


            w = (w < $(this).width()) ? $(this).width() : w;
            
            $("#chart").width(w);
            $("#chart").kendoChart({
                theme: $(document).data("kendoSkin") || "default",
                dataSource: {
                    data: eval(document.getElementById("txtSerializeData").value)
                        },
                title: {
                    text: "On CR Vs off CR"
                },
                legend: {
                    position: "bottom"
                },
                seriesDefaults: {
                    type: "line",
                    stack: false
                },
                series: [{
                    field: "onCR",
                    name: "On CR"
                }, {
                    field: "offCR",
                    name: "Off CR"
                }],
                valueAxis: {
                    labels: {
                        format: "{0}%" 
                    }
                },
                categoryAxis: {
                    field: "Date",
                    rotate:90
                },
                tooltip: {
                    visible: true,
                    format: "{0}%"
                }
            });




        }


 
        // createChart();
        //                $(document).ready(function() {
        //                    setTimeout(function() {
        //                        createChart();
        // 
        //                        $("#example").bind("kendo:skinChange", function(e) {
        //                            createChart();
        //                        });
        //                    }, 400);
        //                });


    </script>
</asp:Content>




//C# Code Behind

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Web.Script.Serialization;


namespace KendoUIDemo
{
    public class GraphData
    {
        public string Date { get; set; }
        public string onCR { get; set; }
        public string offCR { get; set; }


    }


    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {


                FillData();


      


            


        }




        private void FillData() {


            DataTable dt = new DataTable();
            dt.Columns.Add("Date", typeof(DateTime));
            dt.Columns.Add("onCr", typeof(Double));
            dt.Columns.Add("offCr", typeof(Double));


            Random r = new Random();


            int range =10;


            int.TryParse(txtNo.Text, out range);
            List< GraphData> rows = new List<GraphData>();


            for (int i = 1; i < range+1; i++)
            {


                GraphData g = new GraphData{Date = DateTime.Now.AddDays(i).ToString("MM/dd"), offCR = (r.NextDouble() * 100).ToString("0.00"), onCR = (r.NextDouble() * 100).ToString("0.00")};


                DataRow dr = dt.NewRow();


                dr["Date"] = DateTime.Now.AddDays(i).Date;
                dr["onCr"] = g.onCR ;
                dr["offCr"] = g.offCR;
                
                rows.Add(g);


                dt.Rows.Add(dr);
            
            }


            dt.AcceptChanges();


            gvData.DataSource = dt;
            gvData.DataBind();




            
            string jsonString = JsonHelper.JsonSerializer<List<GraphData>>(rows);


            JavaScriptSerializer serializer = new JavaScriptSerializer();
            string jsonData = serializer.Serialize(rows);
            txtSerializeData.Text = jsonData;


        }


    }
}




//Helper Class for Creating JSON Data


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.IO;
using System.Runtime.Serialization.Json;
using System.Text;


namespace KendoUIDemo
{




        public class JsonHelper
        {
            /// <summary>
            /// JSON Serialization
            /// </summary>
            public static string JsonSerializer<T>(T t)
            {
                DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(T));
                MemoryStream ms = new MemoryStream();
                ser.WriteObject(ms, t);
                string jsonString = Encoding.UTF8.GetString(ms.ToArray());
                ms.Close();
                return jsonString;
            }
            /// <summary>
            /// JSON Deserialization
            /// </summary>
            public static T JsonDeserialize<T>(string jsonString)
            {
                DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(T));
                MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(jsonString));
                T obj = (T)ser.ReadObject(ms);
                return obj;
            }
        }
    
}





T. Tsonev
Telerik team
 answered on 11 Sep 2012
1 answer
209 views
When updating a field directly bound to a model both the Set and Changed events on the model are triggered. However when I update a field that has beeen bound using a template, only the changed event is triggered.
I guess I'm doing something wrong.
An example of the issue is here
http://jsfiddle.net/stephenrjames_uk/K8Q6D/3/

If you update the Template Field you will see just the changed event firing whereas updating the bound field triggers 1 set and 3 changed events.
Alexander Valchev
Telerik team
 answered on 11 Sep 2012
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?