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

How to use QueryString Values in Kendo UI Mobile

3 Answers 369 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jarrett
Top achievements
Rank 2
Jarrett asked on 18 Aug 2012, 07:00 PM
I am sure this is a dumb question but I have not been succesful in finding the answer.  How do I get the value of a querystring example below im trying to get the querystring value from querystring parameter named ID and set it in the data part of my datasource.  my data source works hard coded.

var

 

 

dsDetails = new kendo.data.DataSource({

group: { field:

 

"_Title", dir: "asc" },

transport: {

read: {

url:

 

"../api/EventDetails",

dataType:

 

"json",

data: {

ID:

 

"4dc2fa9a-fb45-4ff5-b6d8-c246dbd3024e";

}

}

}

},

schema: {

model: {

fields: {

_ID: { type:

 

"string" },

_BeginDate: { type:

 

"string" },

_Cost: { type:

 

"string" },

_EndDate: { type:

 

"string" },

_EndTime: { type:

 

"string" },

_EventType: { type:

 

"string" },

_StartTime: { type:

 

"string" },

_SupportedBy: { type:

 

"string" },

_Title: { type:

 

"string" }

}

}

},

});

ds.read();

3 Answers, 1 is accepted

Sort by
0
Jarrett
Top achievements
Rank 2
answered on 30 Aug 2012, 04:10 PM
Possibly im asking this question wrong that is a querystring should not be used with a kendo ui mobile web app.  Basically I want to select an item on a listview have that post the value to a different Page/View  and use that value as a parameter in the data source on the new page/view
0
Jarrett
Top achievements
Rank 2
answered on 31 Aug 2012, 02:01 PM
OK I have found that querystring values are called View Parameters and can be used like this lets say this is the link used to call the page:  http://localhost:54235/Mobile/#MyDetails.htm?ID=9a4b15a5-c5f1-46f1-a510-51602c53e65d 


<div data-role="view" data-layout="default" id="MyDetails" data-show="MyDetailsShow" >
</div>

<script>
function MyDetailsShow(e) {
var IDstring = e.view.params.ID
};
</script>

This will set the variable IDstring = to the querystring value for ID.  

My issue is this only works the first time the page loads,  so if you use the back button, then select a different item from the main list, you have to refresh the MyDetails view/page in order for the information to show.   Im now not sure about the Kendo UI Mobile page life cycle.  
0
Mike
Top achievements
Rank 1
answered on 13 May 2014, 08:16 AM
This helped.  Thanks for sharing.
Tags
General Discussions
Asked by
Jarrett
Top achievements
Rank 2
Answers by
Jarrett
Top achievements
Rank 2
Mike
Top achievements
Rank 1
Share this question
or