Jqxgrid selected row colour


#1

Hi,

I am trying to set the colour of a selected jqxgrid row.
The css is as below:

.jqx-grid-cell-selected {
    background-color:blue;
}

I tried to use $("#Grid1 .jqx-grid-cell-selected").css(“background-color”, “blue”) but nothing happens.
Am i doing this wrong?

Thanks


#2

Grid1.cells(r,c).style.backgroundColor = vbblue


#3

Thanks for your reply.

What you’ve shown works for the common grid but not jqxgrid, which is what i am using.


#4

Sorry. Late at night reply. Brain not fully engaged.


#5

Has anyone else had any joy with colouring selected rows using jqxgrid?

This site here has the css code required to achieve this but I cannot make it work in NSB.
https://jseditor.io/?key=change-row-color-in-jqxdatatable-on-selected-hover

Thanks


#6

I came across a response on the jqwidgets forum that says row selection colour can be achieved using:

$('#grid').on('rowselect', function (event) {
 $("#grid").jqxGrid('refresh');
  setTimeout(() => {
     let cells = $(".jqx-grid-cell-selected");
     for (let i in cells) {
         if (i < cells.length) {
             let cell = cells[i];
             cell.style.backgroundColor = 'red';
         }
     }
 },5);

});

Can this be translated in NSB?

Thanks


#7

This code is in JavaScript. AppStudio allows you to embed JavaScript snippets in your BASIC code:

JavaScript
  (some code in JavaScript)
End JavaScript

#8

Thank you, that’s got it.