question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Questions about html filter in ng2-smart-table

See original GitHub issue

I have 2 questions: 1 - What configuration do I need to make so that a column filter is activated when typing 1 character? In my implementation it works from 2 characters. 2 - I put the type of a column in my table as html because it shows a stripe with status color. As the column type is html how can I filter this column? Below is an example of a piece of code.

statusRDO: { title: ‘Status RDO’, type: ‘html’, valuePrepareFunction: (row, data) => { if (data.status === “1”){ return <div class="text-left" id="1"><span class="badge badge-warning">PREENCHENDO RELATÓRIO</span></div>; } else if (data.status === “2”){ return <div class="text-left" id="2"><span class="badge badge-danger">REVISAR RELATÓRIO</span></div>; } else if (data.status === “3”){ return <div class="text-left" id="3"><span class="badge badge-success">APROVADO</span></div>; } },

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
hakimzuldevcommented, Oct 8, 2021

@hakimzulcode There is a table setting property onComponentInitFunction.

You can use it like below.

tableSettings = {
  ...
  renderComponent: ComponentToRender,
  onComponentInitFunction: (instance) => instance.propertyToSet = propertyValue,
  ...
}

It worked! Thank you!

1reaction
vatsalkgorcommented, Sep 30, 2021

@hakimzulcode There is a table setting property onComponentInitFunction.

You can use it like below.

tableSettings = {
  ...
  renderComponent: ComponentToRender,
  onComponentInitFunction: (instance) => instance.propertyToSet = propertyValue,
  ...
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Access the Filter Content in ng2-smart table - Stack Overflow
You can just use the filterFunction attribute in the desired column, and do whatever you want. Here's an example for my filter function....
Read more >
ng2-smart-table - Angular data table library with sorting ...
Actions ID Full Name User Name Email EditDelete 1 Leanne Graham Bret Sincere@april.biz EditDelete 2 Ervin Howell Antonette Shanna@melissa.tv EditDelete 3 Clementine Bauch Samantha Nathan@yesenia.net
Read more >
lorenzofox3/Smart-Table - Gitter
Hi, I've been successfully using smart-table for some time now, but now my customer has requested to show the number of rows that...
Read more >
How Filter Custom Data Returned From Valuepreparefunction In
I tried with type:'html' attribute on Permission columns We have added the ng2 smart table to our applications it works great but we...
Read more >
Smart Table | SAP Fiori Design Guidelines
You expect this to cause performance problems. You use a responsive table and use ... The smart table can be linked to a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found