Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom value/text fields not working, always expecting id/name for value/text fields #28

Open
skaluva opened this issue Jun 25, 2018 · 0 comments

Comments

@skaluva
Copy link

skaluva commented Jun 25, 2018

Hi,
I followed the document. I'm using code as shown below:
In component.ts file, defined property like this:

fes = [{
    'id': 'pp',
    'name': 'pp'
  }, {
    'id': 'bz',
    'name': 'bz'
  }];

In component.html, defined like this:

    <div class="row">
        <div class="col-md-8 col-md-offset-2">
          <ng2-dual-list-box [data]="fes" valueField="id" textField="name"
                             (onAvailableItemSelected)="log($event)"
                             (onSelectedItemsSelected)="log($event)"
                             (onItemsMoved)="log($event)"></ng2-dual-list-box>
        </div>
      </div>

This is working as expected.

But if i define, custom valueField & textField properties. Its not taking those custom fields instead always expecting id/name in data.

In component.ts file, defined property like this:

fes = [{
    'fId': 'pp',
    'fName': 'pp'
  }, {
    'fId': 'bz',
    'fName': 'bz'
  }];

In component.html, defined like this:

<div class="row">
        <div class="col-md-8 col-md-offset-2">
          <ng2-dual-list-box [data]="fes" valueField="fId" textField="fName"
                             (onAvailableItemSelected)="log($event)"
                             (onSelectedItemsSelected)="log($event)"
                             (onItemsMoved)="log($event)"></ng2-dual-list-box>
        </div>
</div>

Its not working. List boxes are not getting rendered. I'm getting below exception chrome's dev console:
image

When i debugged the code in chrome, this plugin ignoring custom values defined for valueField and textField properties in component.html. Instead, it always expecting valueField="id" and textField="name". Check below screenshot:

image

Are custom values supported for valueField and textField ??
Or am i doing anything wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant