#00AF33
Bark Different.
102833
0
1
Feb 12, 2023 16:57:46 GMT -8
RedBassett
I'm a Marxist/Lennonist of the Groucho/John variety.
15,405
April 2007
applecomputer
RedBassett's Mini-Profile
|
Post by RedBassett on Aug 8, 2013 2:27:32 GMT -8
I feel like I saw a thread on this before, but why does the route object go blank when a pageChange occurs? Once the pageChange has occurred, is there any way to grab the data that was in route other than via the page URL?
|
|
#00AF33
Official Code Helper
19529
0
1
Nov 19, 2012 14:18:28 GMT -8
Todge
**
17,324
January 2004
todge
|
Post by Todge on Aug 8, 2013 9:51:15 GMT -8
I've never had any issues with grabbing proboards.data('route').name. For a long time I had a small code giving me page name when needed, and never once found it to be empty.
|
|
inherit
The Dream Crusher (Ret.)
164921
0
Apr 1, 2014 11:00:25 GMT -8
Tim Camara
Teach a man to fish, etc., etc.
1,721
March 2011
tcamara
|
Post by Tim Camara on Aug 8, 2013 10:03:59 GMT -8
I can tell you it changes because we use it internally for various things, one of which involves the AJAX that's run when you paginate. I'm not sure why it's clearing for you, generally it should just change to something like list_posts or list_threads.
|
|
inherit
King Oligochaete
126470
0
Feb 24, 2021 12:23:15 GMT -8
Wormopolis
Stop rating plugins with 1 star that dont deserve it.
20,002
June 2008
tbserialkillers
Wormo's Mini-Profile
|
Post by Wormopolis on Aug 8, 2013 14:38:19 GMT -8
I can tell you it changes because we use it internally for various things, one of which involves the AJAX that's run when you paginate. I'm not sure why it's clearing for you, generally it should just change to something like list_posts or list_threads. That messed with me the first few times I encountered it because I never expected route to change. what I have been doing lately is checking for the instance of proboards('page').board or proboards('page').thread to help me determine if I am on the right pages anymore.
|
|
#00AF33
Bark Different.
102833
0
1
Feb 12, 2023 16:57:46 GMT -8
RedBassett
I'm a Marxist/Lennonist of the Groucho/John variety.
15,405
April 2007
applecomputer
RedBassett's Mini-Profile
|
Post by RedBassett on Aug 8, 2013 14:56:38 GMT -8
So I just retested it on a test forum. On the first load of a page, it shows name "thread" and params.thread_id is the ID of the thread in question. After changing pages, the name is "list_posts" and params is empty.
I have worked around it by caching the route object in my code (I care about the thread ID and the fact that I am on the thread page, not the page change, written a function to grab the page number from the query string in the URL, and will probably write a init function for the first time the page loads, and then a separate refresh function for page changes (currently I cache the route object because I call init on page change).
The name route always implied to me that it would show something like the nav tree. I know you guys are still working on the documentation, I just had a bit of coder's disappointment when the magic object didn't contain what I thought it did, and still requires me to pull data from the URL.
|
|
inherit
The Dream Crusher (Ret.)
164921
0
Apr 1, 2014 11:00:25 GMT -8
Tim Camara
Teach a man to fish, etc., etc.
1,721
March 2011
tcamara
|
Post by Tim Camara on Aug 8, 2013 15:21:34 GMT -8
If you're just trying to retrieve the thread id, proboards.data('page').thread.id should reliably retrieve that for you, like Wormopolis pointed out.
|
|
#00AF33
Bark Different.
102833
0
1
Feb 12, 2023 16:57:46 GMT -8
RedBassett
I'm a Marxist/Lennonist of the Groucho/John variety.
15,405
April 2007
applecomputer
RedBassett's Mini-Profile
|
Post by RedBassett on Aug 8, 2013 15:33:09 GMT -8
If you're just trying to retrieve the thread id, proboards.data('page').thread.id should reliably retrieve that for you, like Wormopolis pointed out. That's where those are. I was sure I had seen thread/cat/board data in the JS, but after months of not touching it I thought it was all in the route object. Thanks! (And apologies Wormopolis, I somehow missed that in your post.)
|
|
inherit
The Dream Crusher (Ret.)
164921
0
Apr 1, 2014 11:00:25 GMT -8
Tim Camara
Teach a man to fish, etc., etc.
1,721
March 2011
tcamara
|
Post by Tim Camara on Aug 8, 2013 15:42:06 GMT -8
ProTip, you can browse through all the available js variables using proboards.dataHash in your console.
|
|
#00AF33
Bark Different.
102833
0
1
Feb 12, 2023 16:57:46 GMT -8
RedBassett
I'm a Marxist/Lennonist of the Groucho/John variety.
15,405
April 2007
applecomputer
RedBassett's Mini-Profile
|
Post by RedBassett on Aug 8, 2013 16:18:21 GMT -8
Yeah, it's been a while since I used any of this stuff And I need to go use a browser where the console scrolls so I can see the content off the page…
|
|
#00AF33
Official Code Helper
19529
0
1
Nov 19, 2012 14:18:28 GMT -8
Todge
**
17,324
January 2004
todge
|
Post by Todge on Aug 8, 2013 16:24:42 GMT -8
I can tell you it changes because we use it internally for various things, one of which involves the AJAX that's run when you paginate. I'm not sure why it's clearing for you, generally it should just change to something like list_posts or list_threads. That messed with me the first few times I encountered it because I never expected route to change. what I have been doing lately is checking for the instance of proboards('page').board or proboards('page').thread to help me determine if I am on the right pages anymore. That had me scratching my head for a while too, I turned to using a good old fashioned location check for a while.
|
|