dtSelector 是一个下拉联动选择器,开发者可以自定义选择器的风格及样式。
打开 dtSelector 插件
open({params}, callback(ret, err))
rect:
{
    x: 0,   //(可选项)数字类型;插件左上角的 x 坐标(相对于所属的 Window 或 Frame);默认值:0
    y: 0,   //(可选项)数字类型;插件左上角的 y 坐标(相对于所属的 Window 或 Frame);默认值:0
    w: 320, //(可选项)数字类型;插件的宽度;默认值:所属的 Window 或 Frame 的宽度
    h: 40  //(可选项)数字类型;插件的高度;默认值:40
}
arrowImage:
arrowSelectImage:
itemCount:
cover:
datas:
[{
        tid: '1001',		
        text: '项目1',
        datas: [
        {
            tid: '1011',		// (可选项)字符串类型;
            text: '子项目1-1', // 字符串类型;列表中显示的文本
        }, {
            tid: '1012',
            text: '子项目1-2',
        }]
    }, 
    {
        tid: '1002',
        text: '项目2',
        datas: [{
            tid: '2001',
            text: '子项目2-1',
        }, {
            tid: '2002',
            text: '子项目2-2',
        }]
}]
styles:
{
    imgW: 12, 						//(可选项)数字类型;箭头宽;默认:12
    imgH: 12,							//(可选项)数字类型;箭头高;默认:12
    fontSize: 15,						// (可选项)数字类型;选择器中字体大小;默认:15
    corner: 0,						// (可选项)数字类型;选择器圆角;默认:0
    bgColor: '#fff',					// (可选项)字符串类型;选择器背景色;默认:#fff
    textColor: '#000',				// (可选项)字符串类型;选择器字体色;默认:#000
    
    selectColor: '#000',			// (可选项)字符串类型;列表选择的字体色;默认:#000
    selectBgColor: '#efeff5',		// (可选项)字符串类型;列表选择的背景色,必须设置selectColor方可生效;默认:#efeff5
    shadowColor: 'RGBA(0,0,0,0.3)', 	// (可选项)字符串类型;遮罩层背景色,默认:RGBA(0,0,0,0.3)
    cellH: 40,						// (可选项)数字类型;列表cell的高度;默认:40
    cellFontSize: 15,				// (可选项)数字类型;列表cell的字体大小;默认:15
    cellMaxShowCount: 5,			// (可选项)数字类型;列表最大显示的行数,超过需拖动显示;默认:5
    cellTextColor: '#000',			// (可选项)字符串类型;列表cell文字颜色;默认:#000
}
fixedOn:
fixed:
ret:
{
    status: true,				// 布尔类型,用来判断操作是否成功
    msg: '打开成功',			// 操作结果消息
    index: 0,					// 所点击的选择器索引(open接口返回无此参数)
    selectIndexes: [1, 1], // 选择器操作后,返回的对应索引数组
}
var selectView = api.require('dtSelector');
selectView.open({
    rect: {
        x: 0,
        y: 0,
        w: api.frameWidth,
        h: 40
    },
    styles: {
        imgW: 12,
        imgH: 12,
        fontSize: 15,
        corner: 0,
        bgColor: '#fff',
        textColor: '#000',
        selectColor: '#000',
        selectBgColor: '#efeff5',
        shadowColor: 'RGBA(0,0,0,0)'
        cellH: 40,
        cellFontSize: 15,
        cellTextColor: '#000',
        cellMaxShowCount: 5
    },
    datas: [{
        tid: '1001',
        text: '项目1',
        datas: [
        {
            tid: '1011',
            text: '子项目1-1',
        }, {
            tid: '1012',
            text: '子项目1-2',
        }]
    }, 
    {
        tid: '1002',
        text: '项目2',
        datas: [{
            tid: '2001',
            text: '子项目2-1',
        }, {
            tid: '2002',
            text: '子项目2-2',
        }]
    }],
    itemCount: 2, 
    fixedOn: api.frameName,
    fixed: false,
}, function(ret){
    if (ret.selectIndexes) {
        alert(ret.selectIndexes);
    }
});
iOS系统 可提供的1.0.0及更高版本
关闭数据列表插件
close()
var selectView = api.require('dtSelector');
selectView.close();
iOS系统 可提供的1.0.0及更高版本
显示dtSelector插件
show()
var selectView = api.require('dtSelector');
selectView.show();
iOS系统 可提供的1.0.0及更高版本
hide()
var selectView = api.require('dtSelector');
selectView.hide();
iOS系统 可提供的1.0.0及更高版本
加载新的数据
reloadDatas({params});
datas:
[{
        tid: '1001',		
        text: '项目1',
        datas: [
        {
            tid: '1011',		// (可选项)字符串类型;
            text: '子项目1-1', // 字符串类型;列表中显示的文本
        }, {
            tid: '1012',
            text: '子项目1-2',
        }]
    }, 
    {
        tid: '1002',
        text: '项目2',
        datas: [{
            tid: '2001',
            text: '子项目2-1',
        }, {
            tid: '2002',
            text: '子项目2-2',
        }]
}]
var selectView = api.require('dtSelector');
selectView.reloadDatas({
    datas: [{
        tid: '1001',		
        text: '项目1',
        datas: [
        {
            tid: '1011',		// (可选项)字符串类型;
            text: '子项目1-1', // 字符串类型;列表中显示的文本
        }, {
            tid: '1012',
            text: '子项目1-2',
        }]
    }, 
    {
        tid: '1002',
        text: '项目2',
        datas: [{
            tid: '2001',
            text: '子项目2-1',
        }, {
            tid: '2002',
            text: '子项目2-2',
        }]
    }]
});
iOS系统 可提供的1.0.0及更高版本
