I am using ng2-smart-table in my project, I want to add a column with checkboxes which while rendering will be checked based on the object which binds the table. In the object, there is a field with a boolean value which will determine if the checkbox will be checked or not, and after making changes in the checkboxes, the changed values should be available.
Asked
Active
Viewed 8,155 times
2 Answers
2
You need to set filter type checkbox
passed: {
title: 'Passed',
filter: {
type: 'checkbox',
config: {
true: 'Yes',
false: 'No',
resetText: 'clear',
},
},
},
in your data you need to pass checkbox value
data = [
{
id: 4,
name: 'Patricia Lebsack',
email: 'Julianne.OConner@kory.org',
passed: 'Yes',
},
]
Try this example Checkbox, Select and Completer filter types

shamim khan
- 467
- 7
- 24
1
I can not provide you a full sample code right now but you should define a column for your checkbox. Provide a boolean value for that column. Don't forget to add
'type: custom'
It renders the Component you provide. I used a component named MyCheckboxComponent
<nb-checkbox [ngModel]="selected"></nb-checkbox>
nb-checkbox is in nebular library.
settings = {
columns: {
checkBox: {
type: 'custom',
filter: false,
width: '10px',
renderComponent: MyCheckboxComponent
}
}
}

boyukbas
- 1,137
- 16
- 24
-
can you provide more complete example, because for me it doesn't render anything – Bosak Oct 28 '19 at 16:22
-
https://akveo.github.io/nebular/docs/components/checkbox/examples#nbcheckboxcomponent if this link doesn't help, I will write an example – boyukbas Oct 28 '19 at 16:47