I am trying to get the flutter web app to append query param to the end of the url (when a selection is made in UI) without reloading the page
Basically I would like to update the URL from http://127.0.0.1:8080/#/sites to http://127.0.0.1:8080/#/sites?arg=1 without page reload
The following line (import 'dart:html') does not work in flutter (The URL does not change at all)
window.history.pushState(null, null, '?arg1=1');
I have also tried the js package (https://pub.dev/packages/js) and it does not work either.
Is there a way to get this to work in flutter web or are there any alternatives to achieve my requirement?
With a bit of struggle, and tried wrapping the call inside a Future.delayed seems to fix that issue.
Future.delayed(
Duration(milliseconds: 100), () => window.history.replaceState(null, null, '${Uri.base.toString()}?accountId=${selectedAccount.accountId}'));
If you have a better answer I would love to know. Thanks
Related
Flutter is Amazing, and so is its widgets and extensive Documentation. I have an issue understanding a possible work around for an issue that is already filed in GitHub issues by many users, This Url will help you learn about the issue for Flutter's Dropdown Button and also the proposed work arounds. I am facing the same issue. There is a possible work around mentioned by Brian Egan in the link, however, I am not sure how to implement the same. I tried to comprehend the mentioned steps and achieve the desired result. However if I add an Expanded widget in my DropdownMenuItem, inside my DropdownButton Widget, it gives me an error for incorrect ParentWidget.
It would be great if someone illustrated the work around to me, anyone who can give me a better explanation.
Note: The issue is currently open, so its alright if we end up relying on the core team for this. But I believe there exists a simple work around here.
As requested in the comments, here is the sample code:
``` new DropdownButton(
value: value,
onChanged: (string) => setState(() => value = string),
items: Items.map((string) {
return new DropdownMenuItem(
child: new Text(string),
value: string,
);
}).toList(),```
Normally with Rails, I'd use will_paginate and call it a day, but I'm using Rails5 purely as an API, and front-end is completely Angular2.
I've looked into NG Bootstrap4's Pagination but I'm having quite a few issues getting it to do anything besides render - And I can imagine why. What is the proper process for Paginating on Angular? I tried using will-paging to paginate the JSON but instead I just limit the results.
I also looked into ng2-pagination which seemed to have a lot of the features I wanted, but I started getting
Uncaught TypeError: ctorParameters.map is not a function errors for everything so I thought maybe I should take it a step back.
Would the proper process be to use the controller in Rails to append a 'page' parameter to the JSON Results? Or would something more like Virtualization be the route I should go?
Having quite a few issues - Even once I have the bar active, it obviously can't control my script.
getDecks(): Observable<Deck[]> {
return this.http.get(this.decksUrl)
.map((response: Response) => <Deck[]>response.json())
.catch(this.handleError);
}
this is the call that contacts the API and gets the response - I feel like I would involve the 'page' here to actually allow Pagination to do something?
I was able to figure it out - multiple issues. For those wondering:
Uncaught TypeError: ctorParameters.map is not a function seems to be a compilation issue with newer packages.
Different library but similar issues
I upgraded Ang2 + Respective libraries to remove error. From there the instructions made a lot more sense.
The pipe should be built directly into your ngFor
<span *ngFor="let deck of decks| paginate: { itemsPerPage: 10, currentPage: p }" class="list-group-item list-group-item-action">
Then placing
<pagination-controls (pageChange)="p = $event"></pagination-controls>
Where-ever you want an async bar resolves the issue.
Works perfectly - Library is Ng2-Pagination
I'm looking for an event fired by polymer-layout when it's finished laying out, similar to the polymer-grid-layout event. Doesn't seem to be one. Am I missing something?
After my attempts at polymer-grid-layout (Autosizing canvas inside a polymer grid layout) I've decided to convert everything to nested polymer-layouts instead. After a few hiccups (e.g. the dart version of polymer-layout doesn't work if you put polymer-layout as an element directly under template, whereas the js version does - don't know which is wrong) the approach seems to be working.
The one exception is that I was previously relying on polymer-grid-layout to tell me when the canvas had been resized properly. But with polymer-layout I have the same timing problem but without the same solution it appears.
Any way around this?
thanks
Anders
Dart polymer_element/polymer_ui_element are a bit outdated. I'll take a look at what changes were be made in JS polymer-layout since I last revisited Dart polymer-layout (probably Mo/Di).
Can you please create an issue in https://github.com/ErikGrimes/polymer_elements so you get notified when the update is made.
You are right that polymer-layout is missing a layout event. I filed an issue here https://github.com/Polymer/polymer-layout/issues/3
In the meantime, you should be able to capture the timeline in attached.
attached: function() {
this.async(function() {
this.async(this.layoutHappened);
});
},
layoutHappened: function() {
}
I used nested async because I don't want to worry about whose attached is called first (this one, or the one in the polymer-layout). And yes, this is exactly the kind of fiddly construction that is avoided by having an event.
I'm working on a DNN site that has been set up before my time here.
There's some conflict with the jQuery I believe, which prevents the modal pop up window in the attached calendar (link) events to not close properly:
http://www.sim-one.ca/NewsandEvents/calendar-of-events.aspx
I tried eliminating one script call at a time to see which one could be messing this up to no avail.
When I test this with the default theme it works like a charm.
Any ideas? Anyone came across something like this before?
Thank you!
You've got plenty of 404 errors on that page, ensure first, that files are in their place.
For example, http://www.sim-one.ca/NewsandEvents/Portals/_default/Skins/SimTwo/includes/js/jquery.listnav-2.1.js was not found. Ensure this path exists.
I agree with Anrie that your references are broken. For example, http://www.sim-one.ca/NewsandEvents/Portals/_default/Skins/SimTwo/includes/css/custom-theme/jquery-ui-1.8.9.custom.css is showing 404 but http://www.sim-one.ca/Portals/_default/Skins/SimTwo/includes/css/custom-theme/jquery-ui-1.8.9.custom.css
You can just use links like :
/Portals/_default/Skins/SimTwo/includes/css/custom-theme/jquery-ui-1.8.9.custom.css in order to fix this in skin file or use <%= SkinPath %>.
Try adding return false; on your event after calling the dnnModal.show()
I've got a very old php application (1999) that has been worked on during the last ten years. At this point the app starts to show it's age so i'm in te progress of migrating to a "new" framework, symfony 1.4. But since the app is very large, i cannot do this at once. So i'm planning to wrap the old app into the new symfony app, and convert functionality by functionality.
First step in this transition was making the old app appear in the new symfony app. So, i've created the "frontend" application, added a "legacy" module, made it the default homepage, and i've put everyhting i had in my index.php (all pages went through this index.php) in the indexSuccess.php file for the indexAction. I've added the code in the "view" because there are also functions in it and changing that setup would take me more time than i want to spend on the old app.
Unfortunately i've now got an issue with global variables. Let me give you an example (i would have never made this register function like this, but it is, so please look past that.
$session = new ps_session;
$demo = "this is a demo variable";
$session->register('demo');
In ps_session i have this method
public function register($var) {
global $$var;
$_SESSION [$var] = $$var;
}
So it should put the content of $demo in a session var named "demo". Clever right :) Anyway, var_dumping shows me the that $$var is "null" and $demo is filled if i var_dump before and after calling the function. Exact same code without symfony and it returns the correct content.
What am i missing? The global call is spread out in all area's of this massive app so i really don't want to switch to something else, so i'm hoping for a quick fix :)
Maybe relevant, the all code except the index.php content are in frontend/lib/legacy/ folder, the index is in frontend/modules/legacy/ (if there is some scope issue i'm missing)
I think that since your indexSuccess.php file is included inside a function (more precisely, here : lib/vendor/symfony/lib/view/sfPHPView.class.php:185 ), this can't work, because $demo is no longer in the global scope. I don't see any easy workaround for this...
I think you should create a legacy folder in /web , and use routing to redirect to it if the url corresponds to something not migrated yet.
I went with putting the entire old site under web/legacy and redirecting from the default index action to the legacy folder. Most of the url's were made by mod_rewrite so easily fixed. The other url's went through a function so fixing was ok, and only a few were hardcoded. To make it totally transparant, i only need to redo the homepage to start from, so i don't have a visible /legacy/ in my url. Thanks for the help!
I agree with greg0ire that this is an issue with the way sfPHPView includes indexSuccess.
Could you simply require index.php in the default/index action?