- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我想使用 ion-select 提供选择选项。我在第一个位置手动添加了全选选项,当我全选时 View 未更新。如何更新 View ?
<ion-select multiple="true">
<ion-option (ionSelect)="allClicked()">select all</ion-option>
<ion-option *ngFor="let item of students ; let i = index" [selected]="item.checked" [value]="item">{{item.studentName}}</ion-option>
</ion-select>
.ts
allClicked(){
if(this.isAll){
console.log(this.isAll)
this.isAll = false;
for (let temp of this.students) {
temp.checked = false;
}
}else{
this.isAll = true;
for (let temp of this.students) {
temp.checked = true;
}
}
console.log("all select event ");
}
最佳答案
就我而言,我遇到了一个非常相似的问题。注入(inject) ChangeDetectorRef 并调用 cdRef.detectChanges()
所以代码必须是这样的:
import {Component, OnInit, ChangeDetectorRef} from 'angular2/core';
export class RecentDetectionComponent implements OnInit, OnDestroy {
constructor(private cdRef: ChangeDetectorRef // <== added ) {
}
allClicked(){
if(this.isAll){
console.log(this.isAll)
this.isAll = false;
for (let temp of this.students)
{
temp.checked = false;
}
}else{
this.isAll = true;
for (let temp of this.students) {
temp.checked = true;
}
}
console.log("all select event ");
this.cdRef.detectChanges(); // <== added
}
}
关于angular - ionic 2 多选与全选复选框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47587707/
我希望 CheckboxModel 在呈现网格时显示为全部选中: 这是我的代码: sm = Ext.create('Ext.selection.CheckboxModel', { li
我有一些按钮可以转换为复选框。单击按钮后,我只需将图标更改为复选标记和背景。我在按钮标签后面有一个隐藏的复选框,当单击按钮时该复选框会更新。 我面临的问题是,当我单击“全选”时,该元素的 btn 和图
我有一个 javascipt 如下: if(document.forms[0].Check_All.value=="Select All"){ for (i = 0; i < chk.leng
我有下表: 书 book_id | book_name | book_photo 标题栏 rubric_id | rubric_name 作者 author_id | first_name | las
我看过this这似乎对我的代码没有影响。我试过了 this这似乎只影响第一个复选框,但当我再次单击它时不会取消选中该复选框....我还看到了其他一些我不确定是否完全符合 Rails 风格(或任何术语)
希望从 Barcharts.com 复制股票期权数据并粘贴到 Excel 表中。 Sub CopyTables() Dim ie As Object Dim I As Long
当用户单击 TEdit1 或单击选择其中的某些文本时,如何选择 TEdit1 的所有文本 最佳答案 执行超出 TEdit 控件默认行为的任何操作都可能非常危险。您的用户知道标准 Windows 控件的
我想打开,然后选择 Word 文档中的所有文本,而不是任何属性、格式等。我搜索了该站点并用谷歌搜索了无止境。基本上类似于打开 Word 文档并按 Ctrl-A 并将结果分配给变量。 $word = N
我在表中有带有标签的复选框。我在表“全选”之外添加了一个复选框,ID 为“chkbox”。现在下面的代码工作正常。这是选择和取消选择表中的所有复选框。现在有一些页面由于业务逻辑而禁用了一些复选框。我希
我有以下 list 和任务结构 现在我想如果有人检查一个任务,我想确保检查 list 也得到检查。当有人取消选中 list 时,所有任务都应该取消选中。
我目前正在使用 Footables显示表格数据。每行都有一个复选框。有一个主复选框可以全选。我遇到了一些困难。该表有一个过滤器。当我应用过滤器并尝试选中该过滤器中的所有复选框时,它不起作用。此外,由于
这是我的代码 my $results = $dbh->selectall_hashref('SELECT * FROM sample.teachers where term like "$search
如果您单独单击每个框,则求和部分起作用,但当您单击全选时则不起作用(尽管全选确实会选中所有框) 有什么想法吗? jQuery Example $(document).ready( func
很难说出这里要问什么。这个问题模棱两可、含糊不清、不完整、过于宽泛或夸夸其谈,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开,visit the help center . 关闭
代码如下: function selectAll(obj) { var theTable = obj.parentNode.parentNode.parentNode.p
我正在处理 DB2 上的一些 SQL 查询。是否可以选择表中的所有列并在该选择语句中使用“as”关键字指定某些条件?例如,这个查询是否可行: select *, col1 + col2 as
我正在尝试创建一个 VB 脚本来导航到网站、全选、复制,然后将复制的数据从剪贴板保存到文本文件,但我被卡住了! :( 这是我到目前为止得到的: With CreateObject("InternetE
我的 Shiny 应用中有一个 checkboxGroupInput,代码如下: checkboxGroupInput("sexe", "Sexe:", c("Masculin" = "mas","F
我想覆盖鼠标单击 DataGridView 标题/列单元格(顶部,左侧单元格)的行为。该单元格会导致所有行都被选中。相反,我想阻止它选择所有行。我看到了 RowHeaderSelect 和 Colum
我正在使用 Angular JS 显示来自 REST API 的输出响应(JSON)。我计划为用户提供列出的每个结果的复选框选项以及全选/取消全选复选框。我一直致力于实现全选/取消全选实现、如何实现全
我是一名优秀的程序员,十分优秀!