英文:
How can I dynamically create Syncfusion Ui's KanbanComponent and set Kanban Component header in ReactJS using TypeScript?
问题
以下是您要翻译的内容:
如何在React js中动态创建syncfusion Ui的KanbanComponent,并动态设置Kanban组件的标题?
<ColumnsDirective>
<ColumnDirective headerText="Active" keyField="Active" allowToggle={true} template={this.columnTemplate} />
<ColumnDirective headerText="Work In Progress" keyField="workInProgress" allowToggle={true} template={this.columnTemplate} />
<ColumnDirective headerText="Approved" keyField="Approved" allowToggle={true} template={this.columnTemplate} />
<ColumnDirective headerText="Closed" keyField="Closed" allowToggle={true} template={this.columnTemplate} />
<ColumnDirective headerText="Archive" keyField="Archive" allowToggle={true} template={this.columnTemplate} />
</ColumnsDirective>
<KanbanComponent
dialogOpen={this.dialogOpen.bind(this)}
id="kanban"
cssClass="kanban-overview"
keyField="T_Status"
dataSource={this.getFilteredData()}
dragStop={(data: any) => {
this.props.onTasksStatusChanged(data);
}}
enableTooltip={true}
swimlaneSettings={{ keyField: "P_ProjectEngineer", allowDragAndDrop: true }}
cardSettings={{
headerField: "T_Title",
template: this.renderCardTemplate.bind(this),
selectionType: "Multiple"
}}
cardRendered={(props: any) => this.cardRenderer(props)}>
<ColumnsDirective>
{this.props.columnName.map((e: any) => {
return <ColumnDirective headerText={e} keyField={e} allowToggle={true} template={this.columnTemplate} />;
})}
</ColumnsDirective>
</KanbanComponent>
英文:
How to create syncfution Ui's KanbanComponent Dynamically in React js and also how to set Kanban Component header Dynamically?
<ColumnsDirective>
<ColumnDirective headerText="Active" keyField="Active" allowToggle={true} template={this.columnTemplate} />
<ColumnDirective headerText="Work In Progress" keyField="workInProgress" allowToggle={true} template={this.columnTemplate} />
<ColumnDirective headerText="Approved" keyField="Approved" allowToggle={true} template={this.columnTemplate} />
<ColumnDirective headerText="Closed" keyField="Closed" allowToggle={true} template={this.columnTemplate} />
<ColumnDirective headerText="Archive" keyField="Archive" allowToggle={true} template={this.columnTemplate} />
</ColumnsDirective>
<KanbanComponent
dialogOpen={this.dialogOpen.bind(this)}
id="kanban"
cssClass="kanban-overview"
keyField="T_Status"
dataSource={this.getFilteredData()}
dragStop={(data: any) => {
this.props.onTasksStatusChanged(data);
}}
enableTooltip={true}
swimlaneSettings={{ keyField: "P_ProjectEngineer", allowDragAndDrop: true }}
cardSettings={{
headerField: "T_Title",
template: this.renderCardTemplate.bind(this),
selectionType: "Multiple"
}}
//dialogSettings={{ fields: fields as any }}
cardRendered={(props: any) => this.cardRenderer(props)}>
<ColumnsDirective>
{this.props.columnName.map((e: any) => {
return <ColumnDirective headerText={e} keyField={e} allowToggle={true} template={this.columnTemplate} />
})}
</ColumnsDirective>
</KanbanComponent>
答案1
得分: 0
以下是翻译好的部分:
如果您想动态设置看板组件的标题,您可以使用看板的"columns"属性。请查看以下代码和示例,
代码片段:
<KanbanComponent
id="kanban"
cssClass="kanban-overview"
keyField="Status"
dataSource={data}
enableTooltip={true}
swimlaneSettings={{ keyField: 'Assignee' }}
cardSettings={{
headerField: 'Title',
template: cardTemplate.bind(this),
selectionType: 'Multiple',
}}
dialogSettings={{ fields: fields }}
cardRendered={cardRendered.bind(this)}
columns={columns}
>
</KanbanComponent>
列设置:
let columns= [
{
headerText: 'To Do',
keyField: 'Open',
allowToggle: true,
},
{
headerText: 'In Progress',
keyField: 'InProgress',
allowToggle: true,
},
{
headerText: 'In Review',
keyField: 'Review',
allowToggle: true,
},
{
headerText: 'Done',
keyField: 'Close',
allowToggle: true,
},
],
示例: https://stackblitz.com/edit/react-pjv7rd?file=index.js
API 链接: https://helpej2.syncfusion.com/react/documentation/api/kanban#columns
谢谢,
Vinitha
英文:
If you want to set Kanban component header dynamically, you can use the columns property of the Kanban. Check the code and sample below,
Code snippet:
<KanbanComponent
id="kanban"
cssClass="kanban-overview"
keyField="Status"
dataSource={data}
enableTooltip={true}
swimlaneSettings={{ keyField: 'Assignee' }}
cardSettings={{
headerField: 'Title',
template: cardTemplate.bind(this),
selectionType: 'Multiple',
}}
dialogSettings={{ fields: fields }}
cardRendered={cardRendered.bind(this)}
columns={columns}
>
</KanbanComponent>
let columns= [
{
headerText: 'To Do',
keyField: 'Open',
allowToggle: true,
},
{
headerText: 'In Progress',
keyField: 'InProgress',
allowToggle: true,
},
{
headerText: 'In Review',
keyField: 'Review',
allowToggle: true,
},
{
headerText: 'Done',
keyField: 'Close',
allowToggle: true,
},
],
Sample: https://stackblitz.com/edit/react-pjv7rd?file=index.js
API Link: https://helpej2.syncfusion.com/react/documentation/api/kanban#columns
Regards,
Vinitha
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论