Skip to content
xizirumeng edited this page Nov 21, 2017 · 4 revisions

引入必要的样式文件及脚本文件

<link rel="stylesheet" href="AdvancedSearch.css">
<script src="AdvancedSearch.js"></script>

绑定对象及初始化

页面元素

<button id="btn"></button>

脚本

var as=new AsSearch("#btn1",{
columns: [
            {
                title: "性别",
                code: "sex",
                type: "select",
                explanation: {"男": "1", "女": "0"},
            }
            , {
                title: "姓名",
                code: "name",
                type: "txt"
            }
            , {
                title: "时间",
                code: "date",
                type: "date",
                dateformat:"yyyy-MM-dd"
            }
            , {
                title: "姓氏",
                code: "xs",
                type: "txt"
            }],
        search: function(result){
            console.log("结果:"+ JSON.stringify(result));
        },
        title:"as",
        shadeEnable:false,
        dateInput: function (obj,dateFormat) {
            //data-date="1979-09-16T05:25:07Z" data-date-format="dd MM yyyy - HH:ii p" data-link-field="dtp_input1"
//            $(obj).attr({"data-date-format": "yyyy-MM-dd HH:MM:SS"});
//            $(obj).datetimepicker({
//                //language:  'fr',
//                weekStart: 1,
//                todayBtn: 1,
//                autoclose: 1,
//                todayHighlight: 1,
//                startView: 2,
//                forceParse: 0,
//                showMeridian: 1
//            });
        }
});
//或者也可以直接丢一个对象给它,一般用于iframe页面在父窗口弹出
var btn=document.getElementById("btn");
var as=new AsSearch(btn,{...});
Clone this wiki locally