我正在尝试角材料数据表。
正如我们所知,默认情况下每行都会发生过滤。
如果我想过滤特定列,那我该怎么办?
我是否应该编写获取所有记录的方法,然后对其进行迭代并比较特定列?
组件.ts
ngOnInit() {
this.service.getUser().subscribe( results => {
if(!results){
return;
}
console.log(results);
this.dataSource = new MatTableDataSource(results);
this.dataSource.sort = this.sort;
})
onSearchClear(){
this.searchKey="";
this.applyFilter();
}
applyFilter(){
this.dataSource.filter = this.searchKey.trim().toLowerCase();
}
Run Code Online (Sandbox Code Playgroud)
组件.html
<mat-form-field class="search-form-field">
<input matInput [(ngModel)]="searchKey" placeholder="search by userName" (keyup)="applyFilter()">
</mat-form-field>
Run Code Online (Sandbox Code Playgroud) 我正在使用 mssql 并且一列有 json 数据,我想通过传递 id 来更新该 json 的那部分(数组)。
{
"customerName":"mohan",
"custId":"e35273d0-c002-11e9-8188-a1525f580dfd",
"feeds":[
{
"feedId":"57f221d0-c310-11e9-8af7-cf1cf42fc72e",
"feedName":"ccsdcdscsdc",
"format":"Excel",
"sources":[
{
"sourceId":69042417,
"name":"TV 2 Livsstil"
},
{
"sourceId":69042419,
"name":"Turk Max"
}
]
},
{
"feedId":"59bbd360-c312-11e9-8af7-cf1cf42fc72e",
"feedName":"dfgdfgdfgdfgsdfg",
"format":"XmlTV",
"sources":[
{
"sourceId":69042417,
"name":"TV 2 Livsstil"
},
{
"sourceId":69042419,
"name":"Turk Max"
}
]
}
]
}
Run Code Online (Sandbox Code Playgroud)
假设如果我要通过customerId和feedId,它应该用我已经通过的提要更新整个提要。
我尝试使用以下查询,但没有帮助。
UPDATE
ExtractsConfiguration.dbo.Customers
SET
configJSON = JSON_MODIFY(configJSON,'$.feeds[]',{"feedName":"ccsdcdscsdc"})
WHERE
CustomerId = '9ee07040-c001-11e9-b29a-55eb3439cd7c'
AND json_query(configJSON,'$.feeds[].feedId'='57f221d0-c310-11e9-8af7-cf1cf42fc72e');
Run Code Online (Sandbox Code Playgroud) 我有一个文本字段和一个单选按钮。
我将这两个值的对象放入一个数组中,以便可以将其存储在Mongo DB中。
我正在构造一个对象数组,并尝试迭代以在表中显示详细信息。
无法显示详细信息。
为此需要帮助。
export class AddColumns extends React.Component{
constructor(props) {
super(props);
this.state={
newItemInput: '',
selectedValue: '',
buyItems :[],
object : {}
}
}
handleChange=(event)=> {
this.setState({
...this.state,
selectedValue: event.target.value
});
};
change (event){
this.setState({
[event.target.name]:event.target.value
});
};
addItem(e){
e.preventDefault();
const newItemInput = this.state.newItemInput;
const newRadioValue = this.state.selectedValue;
const obj = {'item':newItemInput, 'columnType':newRadioValue};
this.state.buyItems.push(obj);
console.log(this.state.buyItems);
}
render(){
const {buyItems,message} = this.state;
return (
<div className="container">
<form className="form-inline" onSubmit={(e) => {this.addItem(e)}}>
<div className="form-group">
<label className="sr-only" htmlFor="newItemInput">Add New Item</label>
<input …Run Code Online (Sandbox Code Playgroud) angular6 ×1
json ×1
json-query ×1
react-native ×1
react-redux ×1
react-router ×1
reactjs ×1
sql-server ×1