Telerik Forums
Kendo UI for jQuery Forum
2 answers
294 views

What is the proper way to edit items in a listview when using Kendo UI Mobile & MVVM?

I don't get the expected results when using the following:

HTML

<div id="itemsView"
    data-role="view"
    data-model="vm">

    <ul data-role="listview" data-bind="source: items" 
                             data-template="itemsTemplate">
    </ul>
    <script id="itemsTemplate" type="text/x-kendo-template">
    <li>
        #=Name#
    </li>
    </script>

    <input type="text" data-bind="value: newValue" />
    <button data-role="button" data-bind="click: update">update</button>
</div>​

JavaScript

var vm = kendo.observable({
    items: [{
        Name: "Item1"}],
    newValue: '',
    update: function(e) {
        var item = this.get("items")[0];
        item.set("Name", this.get("newValue"));
        //adding the follwoing line makes it work as expected
        kendo.bind($('#itemsView'), vm);
    }
});

kendoApp = new kendo.mobile.Application(document.body, {
transition: "slide"});​

I expect the listview to reflect the change to the Name property of that item. Instead, a new item is added to the listview. Examining the array reveals that there is no additional item, and that the change was made. (re)Binding the view to the view-model updates the list to reflect the change. Re-Binding after a change like this doesn't seem to make any sense.

Here is the jsfiddle: http://jsfiddle.net/5aCYp/2/

Note: This was originally posted on StackOverflow:
http://stackoverflow.com/questions/13739125

user1843640
Top achievements
Rank 1
 answered on 07 Dec 2012
2 answers
259 views

Hello,

I am wondering if the following behavior is intentional, and if there is a work-around.

The behavior I am describing can be seen on your TreeView demo at the following: 
http://demos.kendoui.com/web/treeview/images.html

When working with the tree on the right 'TreeView with sprites', notice how highlighting and expanding collapsing nodes works. Any node I click on gets highlighted orange as it is in a selected state, regardless of whatever node I expand/collapse the selected state stays on the originally selected node and no appearance changes occur with any other nodes. Play around with this for a little. This is all good.

Now...

1) Select the 'index.html' node (under the 'Kendo UI Project' folder node)
        2) Collapse the 'Kendo UI Project' parent folder node
        3) Collapse the 'My Documents' root node
        4) Notice how the 'My Documents' root node gets a grey highlight
        5) Expand the 'My Documents' root node (grey highlight remains)
        6) Expand the 'Kendo UI Project' folder node
        7) Notice how the grey highlight now is removed from the root node, and you can see the original 'index.html' node is still selected

Or another scenario:

1) Refresh the web page
        2) Without selecting any nodes, collapse all nodes on tree
        3) Expand the 'My Documents' root node
        4) Notice how the 'My Documents' root node gets a grey highlight



What is with the root node getting highlighted grey?

Is that intentional?

Either way, is there a workaround way to stop this from occurring?


Thanks for your help!
- Lee
Lee
Top achievements
Rank 1
 answered on 07 Dec 2012
3 answers
1.1K+ views
How do I change the template that is used on the popup that is displayed when the Add New Record option is clicked on the Kendo Grid? For example, I would like to change the "Edit" title of the popup window as well as not display certain data items as editable, such as the ID. I've looked all over on the forums and cannot find any way to do this.
Alexander Valchev
Telerik team
 answered on 07 Dec 2012
3 answers
229 views
I got dataSource config
new kendo.data.HierarchicalDataSource({
                   transport: {
                        read: {
                            url: '/getnodes'
                        }
                    },
                    schema: {
                        model: {
                            id: '_id'
                        }
                    }
                })

also I have a method wich provide adding nodes to treeview
addNode: function() {
     var tree = this.tree, //this.tree == $('#treeview').(/* config here */).data('kendoTreeView')
           sel = tree.select();

       /* some code here */

      $.ajax({
           url: '/addnode',
           data: {parent: parent},
           success: function(row) {
              el.append({
                        _id: row._id,
                        name: row.name
                    }, sel);
           }
      })
}

so what we have

node will added success, but afer - dataSource generate request to '/getnodes' and get it from database and render it to treeview
in result we have two same node in one brunch
please help to solve this problem
Georgi Krustev
Telerik team
 answered on 07 Dec 2012
1 answer
130 views
I've created a Kendo UI localization project in Github which localizes all texts in a single package for all controls in Kendo UI.

Unfortunately the Editor's OUTDENT text is not being localized.

You can find the issue in the Github tracker here: https://github.com/loudenvier/kendo-global/issues/2

You can download and run the test in the 3 languages and the only missing translation is the Outdent text.

Maybe it is a problem with the way I'm doing the translations on the project (the only way to accomplish that in a transparent manner was to change the prototype of the many widgets and "extend" the options with the translated texts - details can be found on the project). But since this is analogous to passing the options for each widget individually I believe the problem lies in the Kendo UI code which is not honoring the options.messages.outdent option.

UPDATE:

The attached zip file has a stand-alone html page which shows the bug by using only standard Kendo UI options for translating the 'indent' and 'outdent' messages. Now it is clear it is a bug in Kendo UI and not something wrong with the way the kendo-global project is translating the messages.
Dimo
Telerik team
 answered on 07 Dec 2012
1 answer
869 views
I want when user clciked a link, he can go back to the previous selected page and selected row of kendo grid. I can get his selected page number without problem by

$("#homesGrid").data("kendoGrid").dataSource.page();

In databound event of Kendo Grid, I cannot set his selected page. I can only set his selected row by
$("#homesGrid").data("kendoGrid").dataSource.page(2);   ====> error

var data = mygrid.dataSource.data();
$.each(data,
function (i, row) {
if (row.Fcode == fcode) {
  $(
'tr[data-uid="' + row.uid + '"]').addClass("k-state-selected");
}

Is the code of that line incorrect or is that I cannot set it in databound event of Kendo Grid?

 

Alexander Valchev
Telerik team
 answered on 07 Dec 2012
3 answers
180 views
Hi,

I have been using KendoUI in several mini pet-projects and it has been a great pleasure. The time has come for me to convince the rest of the team to use KendoUI in our flagship product.

I really like the KendoUI Mobile Layout and would like to know if there is similar functionality in KendoUI Web. What is your approach in organizing layout for larger web applications? Should we use KendoUI Mobile Layout even if our application is not intended for use on mobile devices? Can similar functionality be accomplished using KendoUI Templates?

Thanks,

Igor
Sebastian
Telerik team
 answered on 07 Dec 2012
9 answers
384 views
Hej,

Firstly, In kendoui.trial.2012.3.1114\examples\mobile\listview\index.html sample page shows when the user click list item, list item turn to blue on press and when the user release to touch list item turn to normal. This is the normal state. 

I apply the same .html file in Icenium Kendo UI framework project but listview item don't react any effect when i select the item on release the item. I don't understand wht is it like that? Is this problem about the kendo framework or the icenium IDE? I am not sure this is this question should be asked here.

On the other hand, the main purpose for my listview is have to fill from web service and i can fill the listview from web service but still the same problem i can't get the click effect on the selected listview item. Here is filling code for listview:

$.ajax({
type: "POST",
url:  SERVICE_URL_GET_FIRM_LIST,
data: "{ firmID:" + firmID + "}",
contentType: "application/json; charset=utf-8",
dataType: "json",
beforeSend: function() {
app.showLoading();         
},
success: function(msg) {
firmItems = JSON.parse(msg.d);
$("#firm-listview").kendoMobileListView({ dataSource: firmItems, template: $("#firmListViewTemplate").text() });           
},
complete: function() {
app.hideLoading();
},
error: function(msg) {
app.hideLoading();
alert('Error Message');
}
}); 

<script type="text/x-kendo-template" id="firmListViewTemplate">
            <p>${Definition}</p><a data-role="detailbutton" data-style="detaildisclose"></a>
</script>


Kind Regards.
Petyo
Telerik team
 answered on 07 Dec 2012
1 answer
143 views
Hello,

In the latest release the destroy methods are added to all widgets which is nice. But in the Menu widget there is a little bug.
There is $(document).unbind(that._documentClickHandler); called, but this is missing the event name. It must be: $(document).unbind('click', that._documentClickHandler);
This is a problem when you use openOnClick is true.

Regards, Jaap
Georgi Krustev
Telerik team
 answered on 07 Dec 2012
3 answers
444 views
How in the heck do you rebind the grid after receiving data from an AJAX request? Specifically, dates? Why do I lose formatting here?

I need help please!!

@{
    ViewBag.Title = "Index";
}
 
@section Scripts {
    <script type="text/javascript">
        var viewModel;
 
        $(function () {
            // Load Data
            $.ajax({
                async: false,
                url: "/Kendo/Home/GetData"
            }).success(function (result) {
                viewModel = new kendo.observable(result);
            });
 
            // Create Grid
            $("#grid").kendoGrid({
                dataSource: {
                    data: viewModel.People,
                    schema: {
                        model: {
                            fields: {
                                DOB: { type: "date" }
                            }
                        }
                    }
                },
                columns: [
                    { field: "FirstName", title: "First Name" },
                    { field: "LastName", title: "Last Name" },
                    { field: "DOB", title: "Date of Birth", format: "{0:MM/dd/yyyy}" }
                ],
                editable: true
            });
 
            $(document).on("click", "#btn-save", function (e) {
                $.ajax({
                    url: "/Kendo/Home/Save",
                    type: "POST",
                    data: JSON.stringify(viewModel),
                    contentType: "application/json"
                }).success(function (result) {
                    var g = $("#grid").data("kendoGrid");
                    viewModel = new kendo.observable(result);
                    g.dataSource.data(viewModel.People);
                     
                });
            });
        });
    </script>
}
 
<div id="grid"></div>
<div id="view">
    <input data-bind="value: firstName" />
    <input data-bind="value: lastName" />
    <button id="btn-save">Save</button>
</div>
Atanas Korchev
Telerik team
 answered on 07 Dec 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
ColorPicker
Pager
Styling
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
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?