Using a checkbox on a first column in data grid

0
Hello,  I have problem. I want to use a checkbox on the first column of a data grid.  My idea was to take an entity (type boolean) an set an association to the other entity (1 to 1).  But the problem is, that the other entites come from an Rest service and so this entities are non persistable.  Do you have any ideas to solve my problem? In Marketplace are some modules, but I don’t know how to use them.   Thank you for all answers. 
asked
1 answers
3

Hi Ron,

I've got this saved (older) piece of css with should get you going from somewhere on the forum. I think this was for Mx7 so you might want to check with developer tools any new or updated classes for Mx9. 

It add a checkbox instead of selections color Just with pure CSS. Just add the class checkboxSelection to you data grid and add the css to your theme

 

.checkboxSelection tbody tr.selected .selectColumn div:before {
    content: "\e067";
    font-family: "Glyphicons Halflings";
    -webkit-font-smoothing: antialiased;
    font-style: normal;
    font-weight: normal;
    line-height: 1;
    letter-spacing: 15px;
    -moz-osx-font-smoothing: grayscale;
    width: 1em;
}

.checkboxSelection tbody tr:not(.selected) .selectColumn div::before {
    content: "\e157";
    font-family: "Glyphicons Halflings";
    -webkit-font-smoothing: antialiased;
    font-style: normal;
    font-weight: normal;
    line-height: 1;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: 15px;
    width: 1em;
}

.mx-datagrid.checkboxSelection tbody tr:nth-child(odd) > td,
.mx-datagrid.checkboxSelection tbody tr.selected:nth-child(odd) > td {
    background-color: #f9f9f9;
    color: inherit;
}

.mx-datagrid.checkboxSelection tbody tr:nth-child(even) > td,
.mx-datagrid.checkboxSelection tbody tr.selected:nth-child(even) > td {
    background-color: #ffffff;
    color: inherit;
}

.checkboxSelection th:first-child div {
    padding-left: 20px;
}

 

answered