Summarize the front-end common control and the solution of the incurable diseases

Source: Internet
Author: User

//Click the expanded eventfunctionExpandmorestr (v) {varStr= ""; if($ (v). Find (' i '). Hasclass (' icon-sort-up ')) ) {$ (v). Find (' I '). attr (' class ', ' Icon-sort-down ')); STR= $ (v). Prev (). attr (' Data-simple ');    $ (v). Prev (). html (str); } Else{$ (v). Find (' I '). attr (' class ', ' icon-sort-up ')); $ (v). Prev (). attr (' Class ', ' text-no-ellipsis '); STR= $ (v). Prev (). attr (' Data-complete ');    $ (v). Prev (). html (str); }}varCommonhelper ={selectpickerhelp:{//use of the Selectpicker controlInit:function(docid,tip) {//Enter the page, first initialize the controlDocId = "#" +docId;            $ (docId). Selectpicker ({noneselectedtext:tip}); }, Building:function(param) {//initializing the control's data                varDocId = "#" +Param.docid; if(NULL! = param.size && "undefined"! = param.size && ""! =$.trim (param.size)) {$ (docId). attr ("Data-size", param.size); }                if(NULL! = param.multiple && "undefined"! = Param.multiple && ""! =$.trim (param.multiple)) {$ (docId). attr ("Multiple", param.multiple); }                if(NULL! = Param.width && "undefined"! = Param.width && ""! =$.trim (param.width)) {$ (docId). attr ("Data-width", Param.width); }                if(NULL! = Param.style && "undefined"! = Param.style && ""! =$.trim (Param.style)) {$ (docId). attr ("Data-style", Param.style); }                varOptions = []; vardata =Param.dataParam.data; if(NULL!=param.dataParam.expendData) {Options.push (' <option value= ' +param.dataparam.expenddata[' val ']+ ' > ' +param.dataparam.expenddata[' name ']+ ' </option > '); } $.each (Data,function(i,e) {Options.push (' <option value= ' ' +e[param.dataparam.val]+ ' > ' +e[param.dataparam.name]+ ' </option> ');                }); $ (docId). Prepend (Options.join (‘‘)); if(NULL! = Param.defaultval && "! = $.trim (param.defaultval) &&" undefined "! =param.defaultval) {                    if($ (docId). attr ("multiple") = = "multiple"){                        varSelections = Param.defaultVal.split (","); $ (docId). Selectpicker (' Val ', selections); }Else{$ (docId). Selectpicker (' Val ', Param.defaultval); }} $ (docId). Selectpicker (' Refresh '); }, ReadValue:function(docId) {varDocId = "#" +docId; if($ (docId). attr ("multiple") = = "multiple"){                    return$ (docId). Val (). Join (","); }Else{                    return$ (docId). Val (); }}, longstrhelper:{simplifystr:function(data,max,style) {//String Collection Display                vardiv = []; varSimpledata =data; if(NULL==data) {                    return""; }                if(data.length>max) {Simpledata=data.substring (0,max) + "..."; }                varDefaultStyle = "Table-layout:fixed;word-break:break-all;overflow:hidden;"; if(NULL! = Style && "undefined"! =style) {                    //filter the style type that repeats with the default style, leaving the default style startstyle = Style.replaceall ("\\s", "" "). ReplaceAll (" "," ");//Remove all spaces                    varStylearr = Style.split (";"); varDefaultkeys = ["Table-layout", "Word-break", "Overflow"];  for(varI =0;i<defaultkeys.length;i++){                         varDFK =Defaultkeys[i]; if(Style.indexof (DFK) >-1) {alert (Defaultstyle.indexof (DFK)); Stylearr= $.grep (Stylearr,function(o,j) {if(O.indexof (DFK) <0){                                      returno;                         }                                }); }                    }                    //filter the style type that repeats with the default style, leaving the default style endstyle = DefaultStyle + Stylearr.join (";"); }Else{style=DefaultStyle; } Div.push (' <span data-complete= ' ' +data+ ' "data-simple=" ' +simpledata+ ' "style=" ' +style+ ' "> ' +simpledata+ ' </span> '); if(simpledata!=data) {Div.push (' <a class= ' Text-expand "href=" javascript:void (0); "onclick=" commonHelper.longStrHelper.expandStr (this); "style= "Float:right;" ><i class= "Icon-sort-down" ></i></a> '); }                returnDiv.join (' '); }, Expandstr:function(v) {//expand or close a long string            varStr= ""; if($ (v). Find (' i '). Hasclass (' icon-sort-up ')) ) {$ (v). Find (' I '). attr (' class ', ' Icon-sort-down ')); STR= $ (v). Prev (). attr (' Data-simple ');            $ (v). Prev (). html (str); } Else{$ (v). Find (' I '). attr (' class ', ' icon-sort-up ')); $ (v). Prev (). attr (' Class ', ' text-no-ellipsis '); STR= $ (v). Prev (). attr (' Data-complete ');            $ (v). Prev (). html (str); }        }        }        }

Summarize the front-end common control and the solution of the incurable diseases

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.