Telerik Forums
Kendo UI for jQuery Forum
8 answers
419 views
These seems to be an issue with using MVVM binding for a mobile app  as I took the web example Web MVVM remote-binding and just changed the libraries to:

script src="../js/jquery.min.js"></script>
<script src="../js/kendo.mobile.min.js"></script>
<script src="../js/kendo.binder.min.js"></script>

Now in Google Chrome debugger I see the exception:
Uncaught ReferenceError: ProductID is not defined

As I look in Fiddler I see that the service (JSONP) call was never issued and must
believe this is the issue. Hopefully MVVM binding can be made to work in
the mobile app as I am evaluating Kendo against Sencha Touch which has
 a wonderful built in MVC pattern. I will not let code be written here
 without use of patterns like MVC abd MVVM so this is not a nice feature
 but a requirement in our choice.

I then made a couple of changes to the code that seemed promising:

1. I added a statement to force the read after the viewModel definition

 

viewModel.productsSource.read();
    Now I see the JSON data in Fiddler with the ProductID but still get the same error. Now I understand that
the datasource should contain observables which should cause the data binding to occur when the JSON data is read. This does not seem to be happening so I added a change method to the datasource that fires wnen the data has been read.It looks like:
change:function() {
       kendo.bind($("#form-container"), viewModel);
},
Now I place a breakpoint on this line and it is hit and the same exception is occuring, hopefully I am missing the obvious! The complete code looks like (HTML is unchanged from example)

var crudServiceBaseUrl = "http://demos.kendoui.com/service";
 
       $(document).ready(function() {
           var viewModel = kendo.observable({
               productsSource: new kendo.data.DataSource({
                   transport: {
                       read: {
                           url: crudServiceBaseUrl + "/Products",
                           dataType: "jsonp"
                       },
                       update: {
                           url: crudServiceBaseUrl + "/Products/Update",
                           dataType: "jsonp"
                       },
                       destroy: {
                           url: crudServiceBaseUrl + "/Products/Destroy",
                           dataType: "jsonp"
                       },
                       parameterMap: function(options, operation) {
                           if (operation !== "read" && options.models) {
                               return {
                                   models: kendo.stringify(options.models)
                               };
                           }
                           return options;
                       }
                   },
                    change: function() {
                       kendo.bind($("#form-container"), viewModel);
                   },
                   batch: true,
                   schema: {
                       model: {
                           id: "ProductID"
                       }
                   }
               }),
               selectedProduct: null,
               hasChanges: false,
               save: function() {
                   this.productsSource.sync();
                   this.set("hasChanges", false);
               },
               remove: function() {
                   if (confirm("Are you sure you want to delete this product?")) {
                       this.productsSource.remove(this.selectedProduct);
                       this.set("selectedProduct", this.productsSource.view()[0]);
                       this.change();
                   }
               },
               showForm: function() {
                  return this.get("selectedProduct") !== null;
               },
               
           });
           viewModel.productsSource.read();
           
       });

 

 

 

 

 

 


 


john
Top achievements
Rank 1
 answered on 14 Sep 2012
1 answer
5.7K+ views
Hi,
I need to insert a link to a phone number and I want that on click event automatically start the call.

In Jquery I use <a href="tel:00-00-000-000" >00-00-000-000</a>

Thanks a lot
Mauro

Ali
Top achievements
Rank 1
 answered on 14 Sep 2012
3 answers
144 views
Good morning,

I am testing the KendoUI Mobile framework in combination with trigger.io
The point is that it shows the background but nothing else.
Then when touching  the screen the Layout/View appears (thats only happening on the the device, not on emulator)
the content also appears when you turn the mobile to landscape.

Some idea why it happens? Any idea to make a workaround (calling some kind of function in data-show per example)??

Best regards!
<!DOCTYPE html>
<html>
<head>
    <title>Test Runner</title>
    <link href="css/kendo.mobile.all.min.css" rel="stylesheet" />
     <script src="js/includes/jquery.min.js"></script>
    <script src="js/includes/kendo.mobile.min.js"></script>
</head>
<body>
    <div data-role="view" data-layout="default" id="default">
        Hello Mobile World!
    </div>
 
    <div data-role="layout" data-id="default">
        <div data-role="header">
            test runner
        </div>
    </div>
    
    
    <script>
 
        window.kendoMobileApplication = new kendo.mobile.Application(document.body, { platform: 'android' }, {
            viewShow: function (e) {
                var viewID = e.view.element.attr("id");
            }
        });
 
 
 
     
 
    </script>
</body>
</html>
Ali
Top achievements
Rank 1
 answered on 14 Sep 2012
0 answers
115 views
Hi, i'm from Peru its my english is poor.
But, how puts name in iframe for window, whit from code:

     var onClose = function() {
         undo.show();
    }

    function onRefresh(e) {

    }

var window2 = $("#window2"),
        undo2 = $("#node_pjpersons").bind("dblclick", function(){
                    window2.data("kendoWindow").center().open();
        });

    if (!window2.data("kendoWindow")) {
        window2.kendoWindow({
            actions: ["Refresh", "Close"],
            width: "615px",
            height:"600px",
            title: "Mis Proyectos",
            visible:false,
            content: "/node/personal-project/",
            resizable: false,
            refresh: onRefresh,
            iframe: true,
            close: onClose
        });
    }

Jorge
Top achievements
Rank 1
 asked on 14 Sep 2012
6 answers
1.6K+ views
Let's say I have a Grid that maps to a Model.  I'd like to add another column which gets data from a second Data Source.  Any idea if this can be done, and what is the best way to go about it?

Thanks
Arturo
Top achievements
Rank 1
 answered on 14 Sep 2012
1 answer
173 views
I want to  display a grid  when a link inside a ListView is clicked . I'm using a template for the ListView.

Html:
<div id="listView" ></div>

<div id="grid" ></div>

Template:

<script type="text/x-kendo-tmplate" id="template">
    <div>
             <ul>
                     <li><a class="list k-link" title="#= title #" id="#= id#" >#= name #</a></li>
                </ul>
    </div>
</script>

I tried to do this using following code but nothing happens. Only id is read correctly but the request is not made.

$(" .list").live({click:function(){
 
    var id=$(this).attr('id');

    $("#grid").kendoGrid({
           dataSource: {
                 transport: {
                        read: "somefile.php?id="+id,  
                 },
               schema: {
                         data:"data",
                          model: {
                               id: "id_pf",
                               fields:{
                                    first:{}, 
                                   second:{}
                               }
                        }
              },
             total: function(response) {
                      return $(response.data).length;
             },

            pageSize: 10
         },

         columns: [
                 { title: "First", field: "first"},
                { title: "Second", field: "second"},
            ]
       });

}});

Vladimir Iliev
Telerik team
 answered on 14 Sep 2012
6 answers
1.0K+ views
How do I disable dragging after the draggable hits its target?
Nohinn
Top achievements
Rank 1
 answered on 14 Sep 2012
1 answer
443 views
I have columns a and column b in our grid,   and instead of average of b, I want SUM(A*B)/Sum(B) to show up in the group by aggregate to give me the weigthed average.

Is there a way to do this with Kendo UI Grid.  Please give an example if you have done this before.

Thanks

Alexander Valchev
Telerik team
 answered on 14 Sep 2012
7 answers
2.0K+ views
Well like everyone, I'm trying to get my window to open in the center the first time it's loaded. 

Initially, I was completely confused as to why the window wasn't opening int he center since I had copied the code exactly. 

function ShowKendoWindow(link) {
        var title = link.getAttribute("WindowCaption");
        var url = link.getAttribute("WindowURL");
        var win = $(".modal-window");
        if (!win.data("kendoWindow")) {
            // window not yet initialized
            win.kendoWindow({
                animation: {
                    open: {
                        effects: { fadeIn: {} },
                        duration: 200,
                        show: true
                    },
                    close: {
                        effects: { fadeOut: {} },
                        duration: 200,
                        hide: true
                    }
                },
                content: url,
                title: title,
                draggable: true,
                modal: true,
                resizable: false,
            }).data("kendoWindow").center().open();
        }
        else {
            // reopening window
            win.data("kendoWindow")
            .refresh(url) // request the URL via AJAX
            .title(title)          
            .center().open() // open the window;
        }
        event.preventDefault();
    }
    

So, what I realized is happening is that the window loads in the center while it's waiting for the content to load via ajax. Once it loads via ajax, it doesn't move the window to the center, it expands from the top left corner to fit the content of the page that it's loading.

Now what we've done( and the reason we aren't using a fixed height/width) is that we have have one function we add to the click so that we can load all kinds of different content in there and we don't have to worry about the window looking lost in a big open div or having scrolling content. 

So, my question, is there any way to get the window to load AFTER the content loads. Or is there some other way tot get it to center itself again after the content loads? This isn't a huge deal, but it's something we'd definitely like to fix.

I've attached some screen shots for you to see what is happening.

Thanks in advance for any help.
Majid
Top achievements
Rank 1
 answered on 14 Sep 2012
6 answers
249 views
When using widget initialization with "data-attributes", can you set min/max date/time for the date/time pickers?

I've tried using "data-min" for both the date and time pickers, but Kendo doesn't like it.

http://jsfiddle.net/q3FPV/3/

Thanks.
Todd
Top achievements
Rank 1
 answered on 14 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
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?