4

I am using jQuery Mobile Split view in my application. It's working fine. I need split view for some pages only and for normal pages I set data-role="page". When i try to load normal pages other than split view pages I am getting the following error

"TypeError: Result of expression 'toPage.data( "page" )' [undefined] is not an object."

In jquery.mobile-1.0.js line number 2458

toPage.data( "page" )._trigger( "beforeshow", null, { prevPage: fromPage || $( "" ) } );
Sarah Vessels
  • 30,930
  • 33
  • 155
  • 222
vinothini
  • 2,606
  • 4
  • 27
  • 42

2 Answers2

1

i was facing the same issue. this doesnt happen for all pages, only a couple of them. this not a solution but a temporary workaround.
just put a try catch around this statement :P your app will work normally. it wont affect the working of your app.
tell me if u are able to find the real issue behind this error.

ghostCoder
  • 1
  • 9
  • 49
  • 72
0

the param of changePage must be a DOM object. So if you want to use changePage manually, you must give it a DOM object. I suggest you use these to function to get DOM object of page

var allPage = $('div.ui-page');//get the DOM of the all pages on the html page
console.log(allPage);

var mainPage = allPage.prev("div#Mainpage");//find to get the previous page
console.log(mainPage);

//input for changePage must be DOM object --> so how we get DOM object?, see some previous lines we'll see the solution
$.mobile.changePage(mainPage, {transition: "slide", reverse: true}, true, true);

As you can see: in the first line, I get all the DOM object from my page. in the next line, I search in the previous DOM objects to find the page I need. and the finally you can give it to changePage function. It'll work perfectly.

Ray Nicholus
  • 19,538
  • 14
  • 59
  • 82
dalmate
  • 462
  • 5
  • 13