This is a migrated thread and some comments may be shown as answers.

Can't get simple edit to work

4 Answers 41 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Brian
Top achievements
Rank 1
Brian asked on 07 Jan 2013, 11:11 PM
I am trying to work up a mobile app similar to your sushi demo.  I've attached a stripped version of what I'm working on.  I'm having a problem getting the data I want to edit to display.  For my data I am using a temporary webapi app to feed the mobile app data.  I'm getting data just fine and retrieve the record object I want, but can't set the values I need to edit.  The function below is where I get the data, and it is there, but I can't set the values.  When the view displays, the fields are empty.  I tried setting up like the sushi demo with it's detail view and template, but calling view.scrollerContent.html with the template and data never worked for me, it would not even display the view.  How else can I either set the values for edit or use a template to do this?  Thanks.
  function getCompanyPackageForEdit(e) { 
    var view = e.view;
     var package = dsPackage.get(view.params.id);
     //alert("package: " + package.Description + " default weight: " + package.DefaultWeightFactor + " weight: " + package.WeightFactor);

     $("#editDefaultWeight").html(package.DefaultWeightFactor);
     $("#editWeight").html(package.WeightFactor);
     $("#editMaxCount").html(package.MaxCountPerDay);

  }
   

4 Answers, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 09 Jan 2013, 04:07 PM
Hi Brian,

KendoUI dependencies included in the page are not correct - there is more than one combined script included at a time. For more information please refer to the relevant documentation. In case you have read this page and have not understood the requirements, please notify us, so that we can change the text and prevent confusion in the future.

Regarding the provided code snippet, jQuery selected elements are inputs. You cannot change the html of an input. Please consider using the .val() method.

Kind regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Brian
Top achievements
Rank 1
answered on 09 Jan 2013, 11:24 PM
Alexander,

Thanks for that.  That works to get the data into the fields I need to edit.  One followup question.  After I edit and update, I can't seem to find info on how to either go back to the menu I was on, or redirect to a new view, or render a new view.  Here is my function that updates and at the end of it that is where I want to either go back, or be able to load/render a new view by #id.  Thanks much.

function updateCompanyPackage(e) {           
    editPackage.set("DefaultWeight", $("#editDefaultWeight").val());             
editPackage.set("CurrentWeight", $("#editWeight").val());
    editPackage.set("MaxCount", $("#editMaxCount").val());
    dsPackage.sync();
    //here I want to redirect/go back/render new view
};
0
Alexander Valchev
Telerik team
answered on 11 Jan 2013, 09:57 AM
Hi Brian,

To achieve that you may use the navigate method of the mobile application. Please check the relevant documentation.

Regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Brian
Top achievements
Rank 1
answered on 11 Jan 2013, 05:12 PM
Alexander,

Thanks for that link and the help.
Tags
General Discussions
Asked by
Brian
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Brian
Top achievements
Rank 1
Share this question
or