在devextreme弹出窗口中没有分配给数据 [英] In devextreme popup assignedto data is not coming

查看:74
本文介绍了在devextreme弹出窗口中没有分配给数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经实现了dx-popup,它可以很好地打开并显示数据,但是分配给数据的显示不正确.

I have implemented the dx-popup which is opening and showing data very well but Assigned to data is not showing properly.

在Trainings.Component.html辅助代码上写为

On Trainings.Component.html Side code written as

 <div *ngFor="let trngs of trainings">
   <dx-button text="View" (onClick)="onShowTrainingDetailInfo(trngs.trainingdetail)">
   </dx-button>
 </div>


 <dx-popup  [showTitle]="true" title="Orientation Training Plan" [closeOnOutsideClick]="true" [(visible)]="trainingDetailVisible">
 <div *dxTemplate="let data of 'content'">
  <div *ngFor="let trainingdetail of currentTrainings">
   {{trainingdetail.task}}// Here the data is showing
     <span *ngFor="let assigned of trainingdetail.assignedto1">
       {{assigned.trainingAssignedName}}<br />//Here The data is not showing
    </span>
     <dx-button class="btn btn-link dropdown-toggle condition_popup" text="View" (onClick)="onShowTrainingPopupInfo(trainingdetail.trainingPopup)">            
    </dx-button>
  </div>
 </div>
 </dx-popup>

 <dx-popup [showTitle]="true" title="Company Manual Training" [dragEnabled]="false" [closeOnOutsideClick]="true" [(visible)]="trainingPopupVisible">  
<div *dxTemplate="let data of 'content'">
     {{currentTrainingPopup.task}}
</div>

TrainingsService.ts如下(如果缺少某些数据,请原谅)

TrainingsService.ts is as below(Please excuse if some data is missed)

 const training: Trainings[] = [
{
trainingsId: 1, plan: 'Orientation', dateAssigned: '11/2/18', status: 'In progress', done: 40 
, trainingdetail:
  [
    {
      trainingDetailId: 1, trainingsId: 1, done: 'true', status: 'In progress', task: `Read the attached list of common terms and abbreviation used in your
       job. Ensure you learn them up and understand them.`, dueDate: 'Sept 16', attachment: '',
      assignedTo1:
        [
          { trainingsAssignedId: 1, trainingAssignedName: 'john', trainingAssignedImage: 'user-photo.png', trainingDetailId: 1 }
        ],
      trainingPopup:
      {
        trainingDetailId: 1, done: 'true', task: `Read the attached list of common terms and abbreviation used in your job. Ensure you learn
             them up and understand them.`, dueDate: 'Sept 16', attachment: '', attachmentFile:
          [{ attachmentFileId: 1, fileName: 'Terms & Abbreviations.docx' }, { attachmentFileId: 1, fileName: 'Terms & Abbreviations1.docx' }],
        history: [
          { historyDetailId: 1, title: 'Ingrid Desna Assigned Task to John Smith and Angela Muller', date: '09/09/16' },
          { historyDetailId: 2, title: 'Ingrid Desna Created Plan', date: '09/09/16' }
        ],
        assignedTo2: [
          { trainingsAssignedId: 1, trainingAssignedName: 'john', trainingAssignedImage: 'user-photo.png', trainingDetailId: 1 },
          { trainingsAssignedId: 2, trainingAssignedName: 'john 2', trainingAssignedImage: 'user-photo-2.png', trainingDetailId: 1 }
        ]
      }

    }
   ]
  }
]; 

 @Injectable()
 export class TrainingsService {
   getTraining(): Trainings[] {
     return training;
   }
 }
 export interface Trainings {
   trainingsId: number;
   plan: string;
   dateAssigned: string;
   status: string;
   done: number;      
   trainingdetail: TrainingDetails[];
 }

 export interface TrainingDetails {
   trainingDetailId: number;
   trainingsId: number;
   done: string;
   task: string;
   status: string;
   dueDate: string;
   attachment: string;
   assignedTo1: TrainingDetailsAssigned[];
   trainingPopup: TrainingDetailsPopUp;
 }

 export interface TrainingDetailsAssigned {
   trainingsAssignedId: number;
   trainingAssignedName: string;
   trainingAssignedImage: string;
   trainingDetailId: number;
 }

Trainings.component.ts文件下面的代码

Trainings.component.ts file below code

export class TrainingsComponent implements OnInit {
  currentTrainingPopup: TrainingDetailsPopUp[];
  currentTrainings: Trainings[];
  trainings: Trainings[]; 
  public trainingDetailVisible = false;
  public trainingPopupVisible = false;

  constructor(service: TrainingsService) {
    this.trainings = service.getTraining();
  }
  onShowTrainingDetailInfo(trainingDetail) {
    this.currentTrainings = trainingDetail;
    this.trainingDetailVisible = true;
  }  
 onShowTrainingPopupInfo(trainingPopup) {
  this.currentTrainingPopup = trainingPopup;
  this.trainingPopupVisible = true;
 }   
}

唯一的问题是我在弹出窗口中放置了assignto1,因此数据显示为空,而不是显示john数据,否则所有数据都显示良好. 我不知道我在那里犯了什么错误

The only issue is that where I placed assignedto1 in Popup the data is coming as empty instead of showing john data else all the data is coming well. I don't know what mistake I have done over there

推荐答案

拼写错误...

您在模型"assignedTo1"(ts文件)中

you have in model "assignedTo1" (ts file)

,并且在您的html文件中,您具有"assignedto1"

and in your html file you have "assignedto1"

P.S.有时,当您将其构建为生产"时(通过@ ngtools/webpack),您很容易发现一些错误,因为它可以验证html/ts文件的完整性

P.S. Sometimes you can easily find some bug when you build as "production" (via @ngtools/webpack) because it verify integrity of html / ts files

这篇关于在devextreme弹出窗口中没有分配给数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆