点击行上的ng2-smart-table应该突出显示

时间:2019-03-15 03:32:00

标签: javascript angular bootstrap-4 ng2-smart-table ngx-admin

我已经尝试解决该问题,但无法突出显示点击事件中的行。

<ng2-smart-table [settings]="settingsPatient" [source]="sourcePatient" (userRowSelect)="patientStudy($event)" (deleteConfirm)="onDeleteConfirm($event)">"

</ng2-smart-table>	

我正在使用角度7,当我单击ng2-smart-table行中的任何行时,未突出显示,例如,当我单击它时更改行的颜色。

这是我的行单击事件功能-(userRowSelect)=“ PatientStudy($ event)”。

2 个答案:

答案 0 :(得分:0)

选中某行后,将向其中添加“ selected”类...在这里,我们可以使用以下方式设置行的样式:

public class GraphTest {
    private GraphHelper helper = GraphHelper.getInstance();

    public static void main(String[] args) {
        GraphTest test = new GraphTest();
        test.testIsRoute();
    }

    public void testIsRoute() {
        Graph commonGraph = new Graph<String>("z");
        System.out
                .println("Expected true, result [" + helper.isRoute(graph1(commonGraph), graph2(commonGraph)) + "]\n");

        commonGraph = new Graph<String>("z");
        System.out.println("Expected false, result [" + helper.isRoute(graph1(commonGraph), graph2(null)) + "]\n");
    }

    private Graph graph1(Graph commonGraph) {
        Graph main = new Graph<String>("a");
        Graph graphb = new Graph<String>("b");
        Graph graphc = new Graph<String>("c");
        Graph graphd = new Graph<String>("d");
        Graph graphe = new Graph<String>("e");

        graphb.addAdjacent(graphc);
        graphb.addAdjacent(graphe);
        if (commonGraph != null)
            graphb.addAdjacent(commonGraph);

        graphd.addAdjacent(graphc);
        graphd.addAdjacent(graphe);
        graphd.addAdjacent(main);

        main.addAdjacent(graphb);
        main.addAdjacent(graphd);

        return main;
    }

    private Graph graph2(Graph commonGraph) {
        Graph main = new Graph<String>("f");
        Graph graphg = new Graph<String>("g");
        Graph graphh = new Graph<String>("h");
        Graph graphi = new Graph<String>("i");
        Graph graphj = new Graph<String>("j");

        graphg.addAdjacent(graphh);
        graphg.addAdjacent(graphj);
        if (commonGraph != null)
            graphg.addAdjacent(commonGraph);

        graphi.addAdjacent(graphh);
        graphi.addAdjacent(graphj);
        graphi.addAdjacent(main);

        main.addAdjacent(graphg);
        main.addAdjacent(graphi);

        return main;
    }
}

working stackblitz is here

答案 1 :(得分:0)

这对我有用:

::ng-deep .nb-theme-default ng2-smart-table tbody tr.selected, .nb-theme-default ng2-smart-table tbody tr:hover { background: rgb(34, 151, 190) !important; border:1px solid blue; }