What is the best way to build JQuery mobile custom components - jquery-mobile

I am working on a experiment of making JQuery mobile custom components with JQuery tmpl(Templating plugin). The component are building using existing JQuerymobile items and also they are programmatic components. I am using plain JavaScript functions and prototypes to create these components. The purpose behind this and I wanted to made a component that can be easily generate pragmatically, i.evar myAccordian = new Accordian() like that.
So is there a more structured way of doing these components(can say widgets) and also the event binding for each.

jQuery Mobile component is created using the $.widget () method defined internally in jQuery Mobile. This method allows to create and initialize the component and add any specific methods.
There are multiple tutorials available which explains the process such as
https://www.hiddentao.com/archives/2011/11/07/how-to-write-a-custom-widget-for-jquery-mobile/
http://the-jquerymobile-tutorial.org/jquery-mobile-tutorial-CH09.php

Related

Selecting components for jquery mobile

I am trying to optimize jquery mobile and select only those components I need with the jquery mobile download builder http://jquerymobile.com/download-builder/.
However, I have troubles deciding which components I actually need. The features I need are these:
Navigation from a page to another
Basic form elements
Theming related to the aforementioned features
Form element components I can probably pick up myself but do I for example need 'Global initialization of the library' listed in core components in the download builder page?

Which are the basic guidelines for using Delphi IntraWeb with Twitter Bootstrap?

I would like to use the Bootstrap Framework with Delphi's IntraWeb (I'm using XE2)? The idea is to have the server side logic done by Delphi, while using the nice controls that come with BootStrap?
What would be the basic components "Hello World" application for this configuration?
What would be the high-level approach for a more elaborate application, for example one with a Bootstrap nav component that has its tab contents populated by Delphi?
Is combining IntraWeb and Bootstrap an overkill? Would I would be better off with an Indy TIdHTTPServer + Bootstrap?
It does not have to be difficult to implement Boostrap with Intraweb, you just have to add the Js files in the ContentFiles property of the IWForm, you just have to take in mind you have to write the html for each component you use for BootStrap.
In http://www.codegearguru.com in the Movie #63 - Using jQuery Mobile with IntraWeb - CodeRage 6 Replay
They have explained how to develope the Fishfact demo using jQueryMobile, using the TIWTemplateProcessorHTML component and standard IW components, so it should no be difficult to adapt it for bootstrap.
Here is the link: http://codegearguru.com/video/063/jQueryMobileFishFacts.html
Althought, there have been a new component suite since last year implementing JQuery and jQuery mobile, you should take a loo at http://www.cgdevtools.com, I'm using them and let me tell it give you IW app a very nice view. AFAIK they are planning to generate a component suite for Bootstrap.
As far as the web-server is concerned, it should provide the necessary files when the client requests them to run bootstrap client-side: Bootstrap: File Structure
To populate the components (client-side), you'll have to create the server-side logic so it will enter the correct javascript that does so into the HTML of the pages.

jQuery Mobile and Knockout.js Issues

Ive read alot about jQuery Mobile and Knockout.js not playing nice together. Should I ditch knockout.js for my mobile pages and stick with jquery mobiles javascript to handle my view updates? Is there a better option?
They work fine together. You will need to manually invoke jquery mobile's various widget methods if you are dynamically generating markup with ko's templating or if you are manipulating CSS or other properties. Custom bindings are another valid approach.
$('#myButon').button('refresh');
$('#myListview').listview('refresh');
$("#myCheckboxList").checkboxradio("refresh");
If your markup is static other than text values, it should be no-brainer.
I just started a new project for mobile website, JQM and KO are combined, they are great frameworks and I've never seen any big issue with them.

jQuery mobile events but without the UI

Is there a (simple) way to get the events functionality of jQuery mobile without any of the UI elements?
This is for upgrading a set of already written UI components to play nice in a mobile environment.
You will have to use data-role=page since those are what the JQM events are fired for.
For rest of the elements within the page you can prevent JQM from styling them using the data-enhance=false flag.
Read the Enhancement Section
From JQM Source
// The current version exposes the following virtual events to jQuery bind methods:
// "vmouseover vmousedown vmousemove vmouseup vclick vmouseout vmousecancel"
You should be able to bind to all these just like any other events using live/on/delegate

jquery mobile disable ui styles formatting

I want to ba able to disable all ui classes and html formatting on every page and still be able to use transitions, load pages via ajax, etc...
I looked through the Jquery Mobile documentation and $.mobile js object but could not seem to find anything.
If anyone knows would be really helpful :)
Download builder: In the works
Now that we’ve decoupled most of the UI widgets, we’ve set the stage
for there to be a download builder. This will let you build a custom
version of jQuery Mobile to only include the parts you need. For
example, you could just use the core files to add Ajax-based
navigation with pushState and leverage some of the touch events and
other utilities with a very lightweight build (roughly 11k). Or, you
could add in specific UI widgets like form elements, listviews, etc.
to create an optimized build. We’re aiming to have a download builder
tool as part of 1.0.
Source:
http://jquerymobile.com/blog/2011/09/08/jquery-mobile-beta-3-released/

Resources