简体   繁体   English

Sencha Touch:在面板上显示和编辑HasMany字段

[英]Sencha Touch: Displaying and editing HasMany field on formpanel

My Question is: How to display and edit a hasMany field on the formpanel of sencha touch API 我的问题是:如何在sencha touch API的面板上显示和编辑hasMany字段

Sencha touch does not have a listbox or any other feature to innately do this. Sencha touch没有列表框或其他任何固有功能。

My example 我的例子

Candidate: 候选人:

  • firstName: [textfield] firstName:[文本字​​段]
  • lastName: [textfield] lastName:[textfield]
  • ... ...
  • list of interviewers 面试官名单

candidate has many interviewers 候选人有很多面试官

I looked into tpl and xtemplates but could not get anything to work 我调查了tpl和xtemplates,但没有任何工作

My idea is to have a textfield that also functions as a search with ajax with an add button ( + ) beside it, if it's any but the first textfield an ( - ) button. 我的想法是要有一个文本字段,该文本字段也可以用作带有ajax的搜索,并在其旁边有一个添加按钮(+),如果它不是第一个文本字段,则为(-)按钮。

Even getting a textfield and a button to display on the same row seems difficult 即使要在同一行上显示文本字段和按钮也似乎很困难

My Models: 我的模特:

     Ext.require('Candidates.model.Interviewer', function() {
        Ext.define('Candidates.model.Candidate', {
            extend: 'Ext.data.Model',

            config: {
                fields: [
                    {name: 'id', type: 'string'},
                    {name: 'firstName', type: 'string'},
                    {name: 'lastName', type: 'string'},
                    {name: 'email', type: 'string'},
                    {name: 'dept', type: 'string'},
                    {name: 'room', type: 'string'},
                    {name: 'greet', type: 'string'},
                    {name: 'present', type: 'boolean'},
                    {name: 'date', type: 'date'},
                    {name: 'status', type: 'string'},
                    {name: 'completed', type: 'boolean'}
                ],
                hasMany: {
                    model: 'Candidates.model.Interviewer',
                    name: 'Interviewers'
                }
            },
      });

Interviewer 面试官

    Ext.define('Candidates.model.Interviewer', {
        extend: 'Ext.data.Model',

        config: {
            fields: [
                {name: 'id', type: 'int'},
                {name: 'firstName', type: 'string'},
                {name: 'lastName', type: 'string'},
                {name: 'username', type: 'string'},
                {name: 'password', type: 'string'},
                {name: 'email', type: 'string'},
                {name: 'dept', type: 'string'}
            ]
        }
    });

in fieldset items [ 在字段集[

    {
        xtype: 'textfield',
        name : 'firstName',
        label: 'First Name',
    },
    {
        xtype: 'textfield',
        name : 'lastName',
        label: 'Last Name',
    },
    {
        xtype: 'textfield',
        name: 'interviewers',
        id: 'interviewerfield',
        label: 'Interviewer(s)',
        tpl: [
            '<div class="candidate">',
                '<tpl for="interviewers">',
                    '<div class="interviewers">',
                        '{firstName}',
                    '</div>',
                '</tpl>',
            '</div>'
        ].join(''),
        store: 'Candidates'
    },

Idea's I tried to even just display a list of interviewers to the field Idea的我甚至尝试只显示该领域的访问者列表

Anybody have any idea a way to display a many field onto the formfield? 有人有什么办法可以在formfield上显示多个字段吗?

我遇到了同样的问题,我找到了Ext.dataview.DataView解决方案,而不是使用Ext.List。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM