Update af.ui.js
Update af.ui.js

I ran into an issue using AF3 where setting the default panel wouldn't set the default view, it would still use the first view encountered.

In my situation, if the user had previously selected a language, I needed the "main" panel to show.  In the below example the "splash" panel would be used. Using loadContent would cause the user to see a flicker or transition from "splash" to "main".

    <div id="language_select" class="view">
        <div class="pages">
            <div id="splash" data-include="content/splash.html" class="panel"></div>
        </div>
    </div>
    
    <div id="mainview" class="view">
        <div class="pages">
            <div id="main" selected="true" data-include="content/main.html" class="panel"></div>
        </div>
    </div>

I looked at the source of af.ui.js and came accross this bit of code:

    var first=$(".view[data-default='true']");
    if(first.length===0)
        first=$(".view").eq(0);
    else
        throw ("You need to create a view");

But giving the appropriate view the "default" data attribute would cause first.length to equal 1, throwing the error.

I changed the code to the following, which I think was the original intention:

    var first=$(".view[data-default='true']");
    if(first.length===0) {
        first=$(".view").eq(0);
        
        if(first.length===0)
            throw ("You need to create a view");
    }

Now in my code I can use something like this to show the appropriate initial panel.

    if (language === null) {
        $("#language_select").attr("data-default", "true");
        $("#splash").attr("selected", "true");
    }
    else {
        $("#mainview").attr("data-default", "true");
        $("#main").attr("selected", "true");
    }

Or give a view the "default" data attribute to a view that isn't the first one encountered.
modulexcite/appframework,naninha/appframework,larrychan/appframework,svdoever/appframework,vincent1988/appframework,JackieWei/appframework,HappyYang/appframework,dongguangming/appframework,patrick-lake/appframework,handong890/appframework,dongguangming/appframework,kityandhero/appframework,jadulled/appframework,topishka/appframework,01org/appframework,huyongliang/appframework,dnydoney/appframework,macong/appframework,larrychan/appframework,Rockfogel/appframework,leonlau81/appframework,Basildcruz/appframework,Basildcruz/appframework,PuterGIrl/appframework,leonlau81/appframework,modulexcite/appframework,gravity-addiction/appframework,haroldoramirez/appframework,Connectlegendary/appframework,areeftee/appframework,mastergizmo/appframework,vincent1988/appframework,windyao/appframework,HappyYang/appframework,eagle-one78/appframework,naninha/appframework,pranay06b/appframework,HandMobile/appframework,Connectlegendary/appframework,windyao/appframework,RobertoMalatesta/appframework,zhuxj/appframework,docnoe/appframework,RobertoMalatesta/appframework,JackieWei/appframework,Docworld/appframework,zhengcq315/appframework,ScalaSoft/appframework,zhuxj/appframework,areeftee/appframework,qq40660/appframework,heyxiaoling/appframework,dizzydriver/appframework,haroldoramirez/appframework,seekchange/appframework,huq2015/appframework,joeey1984ad/appframework,b-cuts/appframework,xujianrj/appframework,maxid/appframework,seekchange/appframework,langowskiadam/appframework,dnydoney/appframework,nomadgit/appframework,topishka/appframework,zhukaijun/appframework,FortschrittApps/appframework,heyxiaoling/appframework,joenjuki/appframework,joeey1984ad/appframework,svdoever/appframework,rockanita/appframework,nomadgit/appframework,dizzydriver/appframework,zhengcq315/appframework,qq40660/appframework,docnoe/appframework,pranay06b/appframework,iamxiaoma/appframework,ImCodeMonkey/appframework,eliassun/appframework,eagle-one78/appframework,ImCodeMonkey/appframework,joenjuki/appframework,maxid/appframework,Docworld/appframework,szdbb1102/appframework,Rockfogel/appframework,webin/appframework,Julienedies/appframework,macong/appframework,FortschrittApps/appframework,01org/appframework,b-cuts/appframework,iamxiaoma/appframework,UmarMughal/appframework,zhukaijun/appframework,kityandhero/appframework,xujianrj/appframework,Julienedies/appframework,mastergizmo/appframework,handong890/appframework,jadulled/appframework,minatocou/appframework,webin/appframework,ScalaSoft/appframework,patrick-lake/appframework,minatocou/appframework,huyongliang/appframework,PuterGIrl/appframework,eliassun/appframework,langowskiadam/appframework,szdbb1102/appframework,HandMobile/appframework,rockanita/appframework,gravity-addiction/appframework,UmarMughal/appframework,huq2015/appframework