TWebStringGrid

Hi,

The OnGetCellClass doesn't fire. Does it  in the imminent new version?

Thanks,

Ken

Is triggered for cells auto created due to loading data via LoadFromJSON(), LoadFromCSV() or in a TWebDBGrid that descends from TWebStringGrid when connecting to a dataset and loading data.

Otherwise, you can use WebStringGrid.CellElements[col,row] to get the HTML element for the cell and set the class this way directly via the element.

Thanks, I had already tried that but can't access CellElements in the beta version!

It should be available for the pas2js compiler (even when the IDE might not indicate it in class completion yet)

Won't compile.

I suggest to wait for the next beta update

Ok thanks. Please don't take this as a critisism as I am a great fan of Web Core but I spend most of my time fighting with the controls trying to make them display as I need them too. Of course I fully understand and accept the inherent problems with using beta software. Your demo projects are too simplistic. I think you should at least have one that is a real world scenario. I again understand that this takes important development time which you would rather use elsewhere.

What exactly do you wish to achieve via OnGetCellClass?


Code like:

procedure TForm1.WebFormCreate(Sender: TObject);
begin
  webstringgrid1.CellElements[1,1].style.setProperty('background-color','red');
end;

should compile and work.

With code like, you can add the CSS class for a cell:
  webstringgrid1.CellElements[1,1].classList.add('myclass');

Thank you, that works well!