Comments (2)
/**
* @@type {({field: string, data: string(搜索内容), searchType: string(搜索类型)})}
* 你要传入的筛选条件
*/
let data = [
{"field":"thA","searchType":"text","data":"searchDataA"},
{"field":"thB","searchType":"text","data":"searchDataB"},
]
//必须在表格初始化完成后调用这个方法
initSearch(data)
function initSearch(data) {
data.forEach(json=>{
//找到对应的列
let searchBox= $("#table").find(`th[data-field="${json.field}"]`)
//点击按钮展开搜索框,JS点击后生成搜索框,这一步是必须的
searchBox.find(".my-table-sort-icon").click()
//根据搜索类型填入搜索值
//else if(...){...}其他类型,类似写法
if(json.searchType === "text"){
searchBox.find(`#${json.field}-search`).val(json.data)
}
//点击搜索按钮
searchBox.find(".btn-sort-primary").click()
})
}
from bootstrap-advanced-sortable.
感谢大佬,解决了
from bootstrap-advanced-sortable.
Related Issues (9)
- 后端传递大量数据到前端解析的时候报错 HOT 4
- 与bootstrap拟态框冲突 HOT 6
- 交互体验和日期类型兼容性问题 HOT 1
- 点击表头筛选控件的时候,报错 HOT 2
- 表格筛选控件关闭方式 HOT 3
- 点选取消无法关闭弹窗
- 尝试了不同路径的写法,在django框架的网页中总是报错
- 表头执行排序或者筛选后,记录序号能否从1重新排列
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bootstrap-advanced-sortable.