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

How to get data from specific row in table ng2 smart table #1316

Open
SkanderLassoued09 opened this issue Jun 9, 2022 · 0 comments
Open

Comments

@SkanderLassoued09
Copy link

I'm working on ngx-admin in ng2 smart table I added a custom button(buttonComponent) that open model
I want to pass data where the button exist


settings = {
    actions: {
      add: false,
    },
    add: {
      addButtonContent: '<i class="nb-plus"></i>',
      createButtonContent: '<i class="nb-checkmark"></i>',
      cancelButtonContent: '<i class="nb-close"></i>',
    },
    edit: {
      editButtonContent: '<i class="nb-edit"></i>',
      saveButtonContent: '<i class="nb-checkmark"></i>',
      cancelButtonContent: '<i class="nb-close"></i>',
      confirmSave: true,
    },
    delete: {
      deleteButtonContent: '<i class="nb-trash"></i>',
      confirmDelete: true,
    },
    columns: {
      _id: {
        title: "ID",
        type: "number",
      },
      nameUser: {
        title: "nameUser",
        type: "string",
      },
      contactName: {
        title: "contactName",
        type: "string",
      },
      phone: {
        title: "phone",
        type: "number",
      },
      email: {
        title: "E-mail",
        type: "string",
      },
      role: {
        title: "role",
        type: "string",

        editor: {
          type: "list",
          config: {
            selectText: "Select the Location to see options...",
            list: this.roles,
          },
        },
      },
      city: {
        title: "city",
        type: "string",
      },
      postCode: {
        title: "postCode",
        type: "string",
      },
      registerAddress: {
        title: "registerAddress",
        type: "string",
      },
      address: {
        title: "address",
        type: "string",
      },
      bindedGroup: {
        title: "bindedGroup",
        type: "string",
      },
      tid: {
        title: "tid",
        type: "string",
      },
      bindedSn: {
        title: "bindedSn",
        type: "html",
        valuePrepareFunction: (cell, row) => {
          console.log(row.bindedSn);
          this.bnsn = row.bindedSn;
          return row.bindedSn;
          // console.log(row);
        },
      },
      bindedTime: {
        title: "bindedTime",
        type: "string",
      },
      longitude: {
        title: "longitude",
        type: "string",
      },
      latitude: {
        title: "latitude",
        type: "string",
      },
      localisation: {
        title: "localisation",
        type: "string",
      },
      openModal: {
        title: "openModal",
        type: "custom",
        renderComponent: NbListComponent,
      },
    },
  };

as shown at last column there is a button that open a modal , by clicking on the button I want to pass bindedSn data of it's row .

NB: tableComponent and modalComponent are not linked as parent and child

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