Is there any way to prepare html for Select2 or Chosen
and render all html on the server side to avoid shaking on the page
In my rails project I want create good UI but pre rendering seems not supported
Does anybody know some good solution to prerender select boxes?
Related
In grails if you rerender a template back on top of itself to update information on a GSP does the old template's DOM get updated or does the new template cause DOM issues by having its own DOM? And also, is it considered good practice to rerender a template on top of itself to update information? I just used this approach for the first time and hence I was wondering if it is considered good practice.
Doing a partial page updates using AJAX is very common with many modern web based UIs or websites. This has little to do with Grails and it's easier to think about what's going on if you think of what is being sent back to the browser as just HTML and ignore the fact it's coming from a Grails template.
That said, your question of "... does the old template's DOM get updated or does the new template cause DOM issues by having its own DOM?" is slightly awkward because templates or HTML fragments don't have a DOM but the entire page as whole within the browser does.
What is happening is the page is rendering, being loaded by the browser and parsed into a DOM, then displayed. When you do a partial page update the browser parses the new fragment into DOM elements and replaces/updates portions of the existing DOM with the new elements.
All in all, this is considered a good practice since it allows you the developer to only update what information needs to be changed within the DOM and not refresh the entire DOM by reloading the entire page.
I hope this helps, if not please comment and I will explain further with theoretical examples if needed.
I am trying to create simple app but it will give me headache to implement simple plugin like tabbar so i have created it using simple HTML.
So my question is if i create my app using simple HTML not even using HTML5 than does it make any difference? Does apple approve it?
No. It shouldn't matter.
HTML5 adds more features to HTML. So any browser which can render HTML5 can render HTML too. But why don't you use HTML5 new features. Anyway, if you stick into HTML. You misses out the ability to use any HTML5 based libraries.
I'm doing an app with jQuery Mobile and Angular.js. Cause we have some issues using both libs, exists an adapter that do "teh job".
So I'm trying using routeProvider to route my pages. But I still can't render pages using this.
Here plunker if u can help show me the way.
http://plnkr.co/edit/DNGiT83csWMmfYnHXOop
Thanks in advance!
I ran into a similar problem and maybe what I learned might help you. It comes down to the differences in the way angular and jquery go from one page/section to another (routing).
First, the basics: angular routes by inserting a chunk of html into your view, then on whatever click/action/etc, removing that html from the view and adding a new chunk of html. Essentially you're on the same page all the time; it's just the included html is changing. In contrast, think of jqm as loading up all the html into the same page, with those html chunks as divs. Instead of removing html chunks and replacing them (via routing), it's just turning divs off and on. (There are multi-page jqm apps but SPAs really highlight the differences.)
My suggestion is to pick which set of features you really want: angular's minimalistic loading (only as you need it), or jqm's flashy transitions and other built-in features. If you've got a massive app with a lot of data on every page, you might want to bypass jqm and use angular alone, and see what you can do with angular's new animate functions. It'll mean you'll need to build (via CSS or javascript) duplicates of the jqm features -- and from what I've seen, you can get close but it won't quite be as pleasantly streamlined as jqm.
If the jqm built-in features are what you really want, then skip using angular's routing. It'll just introduce all kinds of complications, anyway. Set up your pages using jqm's pattern, and use angular only where you're dealing with data.
What I've found works best is to treat it like it's a jqm app overall, and only add angular into the sections where you need it. After all, you don't have to add ng-app at the html line; you can add it into a single div as needed. Since jqm is happiest as a system-wide kind of thing, while angular is just fine being confined to pieces within a system, so far I've found jqm-whole and angular-parts to be the simplest way to get the best of both worlds.
I want to create a multiple page jQuery Mobile application and don't have any idea how to do that in a proper way.
Is is better to go for a single HTML file for each page or better putting all pages in one single file? How about changing pages and reacting to events like initializing, stopping, starting, coming back to pages, etc.?
I'd like to know the perfect way to build the page change with all the events in jQuery Mobile.
It depends on your application, you can either put all pages together or separate them. All Jquery transaction work with both methods.
Read more about this subject here: Pages
Is there a templating language that has both server-side ruby (pref. rails) and JS renderer?
Here is why this would be useful: Consider you want to display a big list of songs. You render the first 50 and a "show more" button.
"Show more" would link to the next 50 songs or would load those with AJAX if JavaScript is enabled.
The simple solution is to return a rendered piece of HTML from the server, but consider how nice would it be songs were returned as JSON and then were rendered using the same template on the client side.
Mustache.
It is Ruby based but there are several different implementations, including JS.
hamlc supports both sides...
slim has a client side version too it is called skim.
Node.js offers the appeal of using javascript on both the server and client side. If you are looking for something more ruby-on-rails like, then check out express.js which is a web-framework built on Node.js. Both of these are server-side frameworks but they offer libraries which can be used on the client side.
Something to keep in mind is that if you are rendering views from JSON data on the client side then you will need to have the client load the javascript libraries to perform these operations and then render the views - which may be a costlier operation. That said, if your view is simple enough, you can always write a simple javascript function of your own to render your JSON data rather than relying on an entirely new framework and view renderer.