我有一个在primeNG数据表之外的刷新按钮.如何以编程方式触发刷新数据表?
这样的事情:
<div class="pull-right">
<button
id="FilterBtnId"
(click)="???">
</button>
</div>
<p-dataTable
#datatable
[value]="datasource"
[(selection)]="jobs"
[totalRecords]="totalRecords"
selectionMode="multiple"
resizableColumns="true"
[pageLinks]="10"
[rows]="10"
[rowsPerPageOptions]="[10, 25, 50, 100]"
[paginator]="true"
[responsive]="true"
[lazy]="true"
(onLazyLoad)="getNewDatasource($event)"
(onRowSelect)="onRowSelect($event)"
>
<p-column [style]="{'width':'40px'}" selectionMode="multiple"></p-column>
<p-column *ngFor="let col of dt.colDefs" [field]="col.field" [header]="col.headerName" [sortable]="true">
</p-column>
</p-dataTable>
Run Code Online (Sandbox Code Playgroud) 我正在使用 primeng p-toast 来显示消息。
我将 p-toast html 放在 app.component.html 中
<div class="main-container">
<router-outlet></router-outlet>
</div>
<p-toast position="top-right" key="main"></p-toast>
Run Code Online (Sandbox Code Playgroud)
并在sharedModule中导入ToastModule和MessageService,以便任何组件都可以使用它。
尝试在许多子组件上使用它显示一条消息,但它没有显示
this.messageService.add({
key: "main",
severity: "info",
detail: "Ready to scan",
});
Run Code Online (Sandbox Code Playgroud)
我仍然需要在孩子的 html 中添加 p-toast html 才能使其正常工作。
子组件通过 app-routing.module 加载
const routes: Routes = [
{ path: "", component: HomeComponent },
{
path: "catalogs",
loadChildren: () =>
import("./catalog/catalog.module").then((m) => m.CatalogModule)
}];
@NgModule({
imports: [
RouterModule.forRoot(routes)
],
exports: [RouterModule],
})
export class AppRoutingModule {}
Run Code Online (Sandbox Code Playgroud)
有没有一种方法可以只声明一个,并且子组件调用 messageService.add 可以在该 p-toast 上显示消息?
我已使用角形材料版本:5.2.1
并想知道如何禁用其动画,尤其是matDialog。
我尝试了@ .disabled,但是没有运气。
我有这个html片段:
<label>
<input type="checkbox"/>
text here
</label>
Run Code Online (Sandbox Code Playgroud)
在我的js中,我想检索'text here'值
这是我的js:
$('input[type=checkbox]').click(function (e) {
var msg = e.target.closest???
});
Run Code Online (Sandbox Code Playgroud)