如何用js实现select下拉框里是树形结构,可复选,select框中传复选所有值?如下图所示。

JavaScript014

如何用js实现select下拉框里是树形结构,可复选,select框中传复选所有值?如下图所示。,第1张

首先说树形结构,国内有个开源的js控件叫zTree,支持复选。

然后下拉框你可能需要自己做一个(html输入框+右边的一个图标按钮)。

最后,用一个隐藏的div把树形结构包起来,这个div设置成绝对定位,在下拉框右侧选择按钮的单击事件处理函数里,显示这个隐藏的div,并把它的位置设置成在下拉框下面就行了。

思路就是这样,要么楼主可以找找有没有其他更现成的控件,extjs4我记得有类似的,但是他的复选功能不太符合中国习惯,也许现在的版本改好了,你可以查查试试看。

从可见的行列表中提取部分: NSArray *indexPathsForVisibleRows = [tableView indexPathsForVisibleRows]

NSMutableIndexSet *indexSet = [NSMutableIndexSet indexSet]

for ( NSIndexPath *indexPath in indexPathsForVisibleRows ) {

[indexSet addIndex:indexPath.section]

}

NSLog(@"indexSet %@",indexSet)

// indexSet <NSMutableIndexSet: 0x11a5c190>[number of indexes: 5 (in 1 ranges

static String fc = ""

public String showDisk(String diskPath) {

String distContent = ""

try {

// 文件

File file = new File(diskPath)

if (!file.exists()) {

distContent = "文件不存在"

} else {

distContent = childFolder(file)

}

} catch (Exception ex) {

distContent = "目录不正确"

}

return distContent

}

public String childFolder(File file) {

File[] chiled_file = file.listFiles()

for (int i = 0i <chiled_file.lengthi++) {

// 判断是文件夹还是文件

File f = chiled_file[i]

if (f.isDirectory()) {

fc += "<b>" + f.getName() + "</b><br/>"

childFolder(f)

} else {

fc += " "

fc += f.getName()

fc += "<br/>"

}

}

return fc

}