DrupalGap icon indicating copy to clipboard operation
DrupalGap copied to clipboard

drupalgap_goto Removes Query String Parameters

Open mkinnan opened this issue 8 years ago • 4 comments

I'm trying to create a query string based URL on a views page on form_submit to reload the page view with updated results after filtering (from a panel containing some filters). I noticed drupalgap_goto appears to be removing the query string. Is this a bug? Or am I implementing incorrectly?

So, this:

var url = 'drupalgap-events?field_tags_event_type_target_id=123&page=0';
drupalgap_goto(url, { reloadPage: true });

actually directs to:

drupalgap-events

and not:

drupalgap-events?field_tags_event_type_target_id=123&page=0

I've tinkered with and without reloadPage but that didn't seem to make a difference.

mkinnan avatar Jun 07 '17 00:06 mkinnan

@mkinnan Possible suspect code blocks:

https://github.com/signalpoint/DrupalGap/blob/7.x-1.x/src/includes/go.inc.js#L146 https://github.com/signalpoint/DrupalGap/blob/7.x-1.x/src/includes/page.inc.js#L253

You may be able to do this just prior to the drupalgap_goto() call:

_drupalgap_goto_query_string = true;

signalpoint avatar Jun 09 '17 12:06 signalpoint

_drupalgap_goto_query_string appears to store the acutal query string and is not a true or false variable.

When drupalgap_goto is called, the query string gets stripped off by _drupalgap_goto_prepare_path. The query string is saved to _drupalgap_goto_query_string. It feels like all the "goto" functions go around in circles because no matter where I attempt to add the query string back it's stripped off again or gives 404 Menu error. I've spent hours and have made zero progress.

mkinnan avatar Jun 20 '17 02:06 mkinnan

@mkinnan As a workaround, you can probably do something like this.

drupalgap_goto('drupalgap-events', {
  field_tags_event_type_target_id: 123,
  reloadPage: true
});

And then in your page_callback and or pageshow you should be able to access target id by utilizing:

console.log(drupalgap.page.options.field_tags_event_type_target_id);

https://github.com/signalpoint/DrupalGap/blob/7.x-1.x/src/dg.js#L77

signalpoint avatar Jun 20 '17 04:06 signalpoint

@signalpoint Thanks! That works for getting the values on the pageshow after the form is submitted.

mkinnan avatar Jun 25 '17 22:06 mkinnan