Javascript 网格过滤器组件定制
我正在使用Griddle组件,并试图定制过滤器组件以满足需求。我得到了Javascript 网格过滤器组件定制,javascript,reactjs,griddle,Javascript,Reactjs,Griddle,我正在使用Griddle组件,并试图定制过滤器组件以满足需求。我得到了未捕获的类型错误:this.props.onChange不是一个函数错误。我遵循这个例子。 这里是组件 列表组件: class UserList extends React.Component { render(){ const users = this.props.users; return( <Griddle data={users} plugins={[plugins.LocalPlugin]} styleCon
未捕获的类型错误:this.props.onChange不是一个函数
错误。我遵循这个例子。
这里是组件
列表组件:
class UserList extends React.Component {
render(){
const users = this.props.users;
return(
<Griddle data={users} plugins={[plugins.LocalPlugin]} styleConfig={styleConfig} components={{Filter}} pageProperties={{pageSize: 5}}>
<RowDefinition>
<ColumnDefinition id="username" title="Username" className="" />
<ColumnDefinition id="firstname" title="First Name" className="" />
<ColumnDefinition id="lastname" title="Last Name" />
<ColumnDefinition id="id" title="Action" customComponent={EditDeleteUser} />
</RowDefinition>
</Griddle>
)
}
}export default UserList;
类用户列表扩展了React.Component{
render(){
const users=this.props.users;
报税表(
)
}
}导出默认用户列表;
自定义Fiter组件:
import React from 'react';
import { browserHistory, Router, Route, Link, withRouter } from 'react-router';
class Filter extends React.Component {
constructor(props) {
super(props);
this.onChange = this.onChange.bind(this);
}
onChange(e) {
this.props.onChange(e.target.value);
}
render() {
return (
<div className="searchInput">
<input
type="text"
className="form-control"
placeholder="search"
onChange={this.onChange}
/>
<label htmlFor="search" className="icon icon-1202" rel="tooltip" title="search"></label>
</div>
)
}
从“React”导入React;
从“react Router”导入{browserHistory,Router,Route,Link,withRouter};
类过滤器扩展了React.Component{
建造师(道具){
超级(道具);
this.onChange=this.onChange.bind(this);
}
onChange(e){
this.props.onChange(即target.value);
}
render(){
返回(
)
}
我在看“这”是什么……所以我想出来了
this.props.setFilter(e.target.value)
为我工作。我在看“这”是什么……所以我明白了
this.props.setFilter(e.target.value)
为我工作