我正在测试PrimeNG并尝试使用数据表.除了活动,一切都很好.我正在尝试使用Growl在选择行时显示消息(如PrimeNG网站上的Events演示).我目前有这个:
import { Component, OnInit, EventEmitter } from '@angular/core';
import { REACTIVE_FORM_DIRECTIVES } from '@angular/forms';
import { DataTable, Column, Schedule, Growl, Message } from 'primeng/primeng';
import { NameListService } from '../shared/index';
@Component({
moduleId: module.id,
selector: 'dash',
templateUrl: 'dashboard.component.html',
styleUrls: ['dashboard.component.css'],
directives: [REACTIVE_FORM_DIRECTIVES, DataTable, Column, Schedule]
})
export class DashboardComponent implements OnInit {
newName:string = '';
newLanguage:string = '';
errorMessage:string;
names:any[] = [];
selectedName:any;
events:any[];
cols:any[];
msgs:Message[] = [];
constructor(public nameListService:NameListService) {
}
ngOnInit() {
this.getNames();
this.cols = [
{field: 'id', …Run Code Online (Sandbox Code Playgroud) 我从How to create a checkbox using listview 中获取了以下代码,它在选中一个项目时检查所有项目。我如何修复代码以不检查所有项目?
class CheckBoxInListView extends StatefulWidget {
@override
_CheckBoxInListViewState createState() => _CheckBoxInListViewState();
}
class _CheckBoxInListViewState extends State<CheckBoxInListView> {
bool _isChecked = false;
List<String> _texts = [
"InduceSmile.com",
"Flutter.io",
"google.com",
"youtube.com",
"yahoo.com",
"gmail.com"
];
@override
Widget build(BuildContext context) {
return ListView(
padding: EdgeInsets.all(8.0),
children: _texts
.map((text) => CheckboxListTile(
title: Text(text),
value: _isChecked,
onChanged: (val) {
setState(() {
_isChecked = val;
});
},
))
.toList(),
);
}
}
Run Code Online (Sandbox Code Playgroud)