problem with

2 posts, 0 answers
  1. dmc_lat47
    dmc_lat47 avatar
    6 posts
    Member since:
    Jan 2007

    Posted 03 Nov 2014 Link to this post

    I have a view with a data-model="App.models.artifacts" view model for artifacts.html that handles capturing and getting photos. I'm using requirejs to include kendo for the datasource.

    * artifacts data-model
        function (kendo, api) {

            var viewModel = kendo.observable({

                dataSource: new{
                    transport: {
                        read: function (options) {
                            .done(function (data) {

                onUploadImage: function (e) {
                onCaptureImage: function (e) {
                onCaptureVideo: function (e) {
                onCaptureAudio: function (e) {

                uploadSuccess: function (e) {


    at first tried creating the getPhoto method within the view model class, but it always performs a capture rather than a getPicture.  After hours of pulling my hair out as to why this was, and playing with the cordova camera sample, I finally got it running correctly by placing the getPhoto function in a separate jscript file that didn't have the kendo reference in it. I changed nothing about the call, except moving it.

    /* camera.js */
      function getPhoto(source) {
        // Retrieve image file location from specified source, onFail, { quality: 50,
            destinationType: destinationType.FILE_URI,
            sourceType: source

    Why doesn't the call within the view model work correctly?

  2. Martin Yankov
    Martin Yankov avatar
    177 posts

    Posted 04 Nov 2014 Link to this post


    I cannot see anything wrong with your code or any reason why this function will not work if you declare it in the view model. Also, I could not understand you completely. What do you mean by "it always performs a capture rather than a getPicture"? In your code I can see that you have both onCaptureImage which calls a capturePhoto function and onUploadPhoto that calls the getPhoto function. This is strange as getPicture() does not upload anything. Further, I don't know what these functions are bound to. If you want me to help you figure this out, please open a support ticket and send us your project, so that I can take a closer look.

    I am looking forward to your reply.

    Martin Yankov

    Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

Back to Top