Drag And Drop From Multiple Possible Sources But Still Use Single CSS Class?
Added by T D almost 9 years ago
I've created a Wt application where the user can drag and drop a row from a source table to a target table. There are many possible source tables the user can select to drag from. It appears for the WDropEvent to have the correct drop source, the "ID" of each source table needs to be unique.
The ID of the source table is set through the setId() method of Wt::WTableView. Here's the problem: As the documentation states here, the ID is used for associating the widget with a CSS class. Since the ID needs to be unique for drag-and-drop to work, I can't use a single CSS class to define the same style for all of my source tables.
How I have it working now is a total hack (see the CSS code below). There has to be a better way to handle this. Does anyone know?
#SourceTable-1, #SourceTable-2, #SourceTable-3, etc, etc
{
font-variant: normal;
font-family: "Verdana";
font-size: 12px;
color: black;
text-align: left;
background-color: white;
border-style: solid;
border-width: 1px;
border-color: #f5871e;
width: 99.3vw;
height: 40vh;
overflow-x: scroll;
}
Replies (1)
RE: Drag And Drop From Multiple Possible Sources But Still Use Single CSS Class? - Added by Koen Deforche almost 9 years ago
I'm not sure I understand: by default every widget has a unique auto-generated ID. Styling preferably is done using style classes, and you can specify any number of style classes for a widget (which can be shared among widgets) using addStyleClass() ?