Telerik Forums
Kendo UI for jQuery Forum
1 answer
139 views
ISSUE #1:

I tested and found you can not apply a badge with value of 0 (zero).
I can understand the original logic why - however it is problematic with dynamic updates of the value via jQuery.   Instead of it  disappearing it does nothing and leaves the old value.
<div id="foo" data-role="view">
  <a data-role="button" data-badge="1" data-click="resetClicks">Reset Badge Count</a>
</div>
 
<script>
var app = new kendo.mobile.Application();
 
function resetClicks() {
    this.badge(0); //set new badge value
}
</script>

You might consider adding another option flag:  data-badge-showzeros to handle all possibilites of user needs. Some may want to show Zero values and other not.
Kamen Bundev
Telerik team
 answered on 26 Nov 2013
1 answer
212 views
I dont need to see all events, I only need to ensure that I can set the height of an event template, to allow for say 2 lines of a title to show up. the current issue I am having is that I cant seem to add any CSS styling on top of my event to ensure that the event template renders using say height auto, or even just height: 45px

just a random number, but my point is still valid, I need to know how to expand the height of an individual event to at least show two lines.

attached is a screen shot from a project I am working on, as you can see the events are only one lined and cuts off the rest of the title.

suggestions?
James Hood
Top achievements
Rank 1
 answered on 26 Nov 2013
1 answer
125 views
Hi,

In the Q2 and Q3 release either flat or native Os when you add a checkbox to a listview and trying to tap it there's a huge delay for the checkbox to be checked or the other way around which is unchecked.

that wasn't their in Q1
Alexander Valchev
Telerik team
 answered on 26 Nov 2013
1 answer
225 views
Hi 

I have a treeview bound to a hierarchial data source from a database and use the requestEnd event to expand all nodes which works fine.

When I add a node via an ajax call it adds the data to the database correctly and I call dataSource.read()  to refresh the treeview as part of my ajax success function:
success: function () {
                      
                      foundItem = false;
                      $("#tree").data("kendoTreeView").dataSource.read();
                  }
 I then use the following code to find the item added (the unique name of which is stored in toSelectText) when the read function binds the tree, select it and display the details:
function onBound(e) {
            if (toSelectText != null && !foundItem) {
 
               var treeview = $("#tree").data("kendoTreeView");
               var selectitem = treeview.findByText(toSelectText);
 
               if (treeview.text(selectitem) == toSelectText) {
                   treeview.select(selectitem);
                   treeview.trigger("select", { node: selectitem });
                   foundItem = true;
               }
           }
 
       };
The foundItem variable is used because the call to this function is made many times as the read builds up the child data for each node.

For the first item that is added it works perfectly but for the second and subsequent items the dataSource.read() is not fired and the tree is not updated and the added item is not therefore selected.

Am I going about this the right way? Why would it work for the first item added but not subsequent items?

Many thanks in advance


Alexander Valchev
Telerik team
 answered on 26 Nov 2013
5 answers
1.3K+ views
I have a scenario with grid within grid implemented using the detailInit method. Here when user makes edit, i  do some calculations that will change the data in the both parent and child. and then to refresh data, i will call the datasource.read to render data. this works and the data is displayed, however any detail grid which are expanded will be collapsed, is there any way i can prevent this from happening.

Regards,
Pramod
SyneITY
Atanas Korchev
Telerik team
 answered on 26 Nov 2013
3 answers
259 views
This is a very difficult issue to explain so I'm going to give you some instructions on how to replicate it and see it for yourself.

1. Go to the Kendo menu demonstration page demonstrating the possible directions.
2. Hover over the "Girl's" menu.
3. Hover over any sub-menu.

When you do this you should see that all the arrows seem to "bounce" when the sub-menu opens.  If you move the mouse up and down the "Girl's" sub-menu items you can clearly see all the arrows within that menu bounce.  This does not happen in any other menu (except when it is the third or greater menu option along and I've checked the CSS, it does not appear to be that which is causing this; I suspect it is a scripting issue.

This also happens on the Orientation demo page, and it even happens with you change the orientation to vertical.

I've attached a screencast in case it is just my browser, but I'm using the latest version of Chrome (v. 31.0.1650.48 m).
Dimo
Telerik team
 answered on 26 Nov 2013
2 answers
216 views

ListView Definition


 var carriers = $("#carrierList").kendoListView({
            dataSource: t94StragglerCarriers,
            selectable: true,
            pageable : true ,
            change: onChange,
            dataBound: onDataBound,
            dataBinding : onDataBinding ,
            template : kendo.template($("#carrierTemplate").html())
        }).data("kendoListView");

Template Definition

<script type="text/x-kendo-tmpl" id="carrierTemplate">
    <div id='carrierListVal' class='k-textbox'>#:val#</div>    
    <br/>
</script>

DataSource Definition

 var t94StragglerCarriers = new kendo.data.DataSource({
            transport: {
                read: {
                    url: "/MenuTrain/T94StragglerCarriers",                    
                    dataType: "json"                   
                },
                schema: {
                    model: {
                        id: "id",                        
                        fields: {
                            id: {type : "string"} ,
                            val: {type : "string"}
                        }                        
                    }
                },               
                pageSize: 5,
                serverPaging : true 
            }
        });

I've tried several variations for the datasource. From not specifying the schema to just specifying the id.

OnChange Event Handler Definition

function onChange() {
            var listView = $("#carrierList").data("kendoListView");
            var index = listView.select().index();
            var item = listView.dataSource.view()[index];
            console.log("Item " + index + " selected. Text = " + item.id);
        }

Here is the json string returned from my controller's action method: 

[{"id":"10eac72a-d62d-434f-8505-4869cdb27b04","val":"CHTT"},{"id":"10eac72a-d62d-434f-8505-4869cdb27b04","val":"CMO "},{"id":"10eac72a-d62d-434f-8505-4869cdb27b04","val":"CTCX"},{"id":"10eac72a-d62d-434f-8505-4869cdb27b04","val":"DBUX"},{"id":"10eac72a-d62d-434f-8505-4869cdb27b04","val":"GATX"},{"id":"10eac72a-d62d-434f-8505-4869cdb27b04","val":"MWCX"},{"id":"10eac72a-d62d-434f-8505-4869cdb27b04","val":"NDYX"},{"id":"10eac72a-d62d-434f-8505-4869cdb27b04","val":"PLMX"},{"id":"10eac72a-d62d-434f-8505-4869cdb27b04","val":"TAEX"},{"id":"10eac72a-d62d-434f-8505-4869cdb27b04","val":"TCIX"},{"id":"10eac72a-d62d-434f-8505-4869cdb27b04","val":"TEIX"},{"id":"10eac72a-d62d-434f-8505-4869cdb27b04","val":"TILX"},{"id":"10eac72a-d62d-434f-8505-4869cdb27b04","val":"UP  "},{"id":"ffbcdb6c-4d3a-45f6-8ef6-ada5f28ba44b","val":"MDXx"}]

The listview renders correctly. But it's as if the listview's select().index() methods are treating each field as an item. For example , the first object's id field is index 0, the first object's val field is index 1, and so on.


What am i doing wrong here?

Matt Miller
Top achievements
Rank 1
 answered on 26 Nov 2013
3 answers
246 views
When i try to step through an event handler for my listview's change event, Firefox locks up. Can not click on any of the debugger menu items. Can't switch back to the console window. Browser becomes completely unresponsive. I am logging to the console window from my event handler, and no errors are mentioned.

I know this has to be something silly on my part, just wondered if any one else has experienced this problem. 

Here is the definition of my ListView : 

var carriers = $("#carrierList").kendoListView({
            selectable: true,
            pageable : true ,
            change: onChange,
            dataBound : onDataBound ,
            dataSource: t94StragglerCarriers,                       
            template : kendo.template($("#carrierTemplate").html())
        }).data("kendoListView");
Here is the event handler : 
function onChange() {
           var listView = $("#carrierList").data("kendoListView");
           var index = listView.select().index();
           var item = listView.dataSource.view()[index];
           console.log("Item " + index + " selected. Text = " + item.val);
       }

Again , this only happens when i try to debug this event handler in firefox.

Thanks in advance.


Alexander Valchev
Telerik team
 answered on 26 Nov 2013
1 answer
137 views
I am trying to set the series name from another field in the model.

For example, my current code is:
            series.Column(model => model.CallbackFrequency1).Name("FREQ 1").Color("#003366");
            series.Column(model => model.CallbackFrequency2).Name("FREQ 2").Color("#999999");
            series.Column(model => model.CallbackFrequency3).Name("FREQ 3").Color("#00ac36");
            series.Column(model => model.CallbackFrequency4).Name("FREQ 4").Color("#e8b700");


The name of the series depends upon a date range selected by the user.  I am returning the name I want to use in the model, but I can not figure out how to dynamically populate the series column name. 

Is this possible?
Daniel
Telerik team
 answered on 26 Nov 2013
1 answer
159 views
I need to be able to 'map' some certain data incoming to an existing javascript object that called upon the appropriate code of my MVVM framework, so I took my hand at trying it myself and I thought I had done a pretty good job, but I am running into a problem.

Edit

I have also created a jsBin to show this behavior exists even without my mapping. This is something that is occuring in the `set` function of kendo, and I want to find a way to stop it

jsBin


Basically, I draw a "mapping" like this, using Kendo's model system.
var Model = kendo.data.Model.define({
   Id: "Id",
   fields: {
       Id: {
           type: "string",
       },
       Name: {
           type: "string",
       },
       Mutations: [],
       Tags: []
   },
   mapping: {
       Tags: {
           children: function (data) {
               return $.extend(data, {
                   onRemove: function (e) {
                       // execute code
                   }
               });
           }
       },
       Mutations: {
           children: function (data) {
               return $.extend(data, {
                   Label: null,
                   onRemove: function (e) {
                       // execute code
                   },
                   onEdit: function (e) {
                       // execute code
                   },
                   onSave: function (e) {
                       // execute code
                   }
               });
           }
       }
   }
});

I know that on the outside, this looks a bit unnecessary, but it works well for me and fits my thinking process. I'm open to suggestions for other ways to do it, but ...

Anyway, the purpose of this is to "map" the `onRemove` functions to the `Tags` array when it comes in from the server, and to map the `onRemove, onEdit, onSave` functions to each child in the `Mutations` array. I can do this 'after' they are loaded, but I wanted to try this approach to learn more about javascript.

So then, this is my mapping code.
kendo.data.ObservableObject.prototype.fromJSON = function (source, mapping) {
    var name,
        value,
        observable = this;
 
    // if there is mapping given, then pass it through that first
    if (mapping) {
        source = kendo.mapping(source, mapping);
    }
 
    for (name in source) {
        if (observable.hasOwnProperty(name)) {
            observable.set(name, source[name]);
        }
    }
 
}

This will call the following code, which I felt pretty proud of myself for writing, considering this is my first time trying to do anything like this in javascript.
kendo.mapping = function (source, mapping) {
    var name,
        value;
 
    // if the user provides us a mapping, we can use that to help
    // build the objects appropriately
    for (name in source) {
        if (source.hasOwnProperty(name)) {
            // get the value for this property or item
            value = source[name];
 
            // try to determine if this is an array, or just a
            // normal object. That will greatly dictate our choice of behavior
            if (value instanceof Array) {
 
                // if this is an array, then we will try to check for a
                // key in the mapping schema
                if (mapping[name].children) {
 
                    // if we discover a mapping key for this array, we
                    // will use it to reconstruct the array data
                    for (var i = 0; i < value.length; i++) {
                        source[name][i] = mapping[name].children(value[i]);
                    }
                }
            } else {
                // attempt to match any non array type keys
                if (mapping[name]) {
                    source[name] = mapping[name](value);
                }
            }
        }
    }
    return source;
}

Now for a while, I thought this was awesome. It was working how I wanted, as demonstrated here;
// -------------------------------------------------------------
// create a kendo ui grid to show the existing prototypes
// -------------------------------------------------------------
widgets.grid = $('#grid').kendoGrid({
    dataSource: {
        transport: {
            read: {
                url: "/administrator/data/prototypes",
                dataType: "json",
                type: 'GET'
            }
        },
        schema: {
            total: "total",
            data: "data"
        },
        page: 0,
        pageSize: 15,
        take: 15,
        serverPaging: true,
        serverFiltering: true,
        type: "aspnetmvc-ajax"
    },
    pageable: {
        refresh: true,
        pageSizes: true
    },
    selectable: "row",
    columns: [
        {
            field: "Id",
            width: 25,
            title: "Identity"
        },
        {
            field: "Name",
            width: 40,
            title: "Name"
        }
    ],
    change: function (e) {
        // get the selected row from the grid
        var selected = this.select();
        // get the data from the selected row
        var data = this.dataItem(selected);
        // update the model
        viewModel.fromJSON(data.toJSON(), viewModel.mapping);
    },
}).data("kendoGrid");
So this code goes to my controller and gets a JSON list of all of the relevant items from the database (stored in `RavenDB` as JSON). This returns flat items, which is exactly how I want them in the database (since the functions can't be serialized, obviously). But when I get them into my UI, I want those functions. So in the `change` function, I take the data and pass it through my `fromJSON` function, which accepts the mapping defined in the view model.

This works, it works very well I think. But then when I try to go further and have other bindings on the view model.. .like this..
viewModel.Mutations.bind("change", function (e) {
   // do something else
});
This is really normal kendo code. I attach the `change` event to a function so that it runs whenever that `ObservableArray` changes. This works fine in my other pages where I don't use mapping, but on this one, once the mapping runs, it seems to become 'unbound'. I have found that if I put the `bind` code _after_ the mapping is done, it works.

So I have to assume that what is happening is that the code that does the binding is somehow hidden inside of the `ObservableArray`, and that it gets deleted when it runs the mapping.

Can anyone help me with this?
Alexander Valchev
Telerik team
 answered on 26 Nov 2013
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
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
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
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
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?