Project

General

Profile

Actions

Bug #2437

closed

Item delegates for WTableView in WBootstrapTheme

Added by Alan Finley over 10 years ago. Updated about 10 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Start date:
11/19/2013
Due date:
% Done:

0%

Estimated time:

Description

When using WBootstrap theme a standard delegate (and all derived) doesn't fit into table cell.

app->setTheme(new Wt::WBootstrapTheme(app));
Wt::WTableView *view = new Wt::WTableView(app->root());
view->setModel(model);
view->setRowHeight(50);
view->setColumnWidth(0, 300);
view->setItemDelegate(new Wt::WItemDelegate);

Here's a screenshot:

Actions #1

Updated by Koen Deforche over 10 years ago

  • Status changed from New to Resolved
  • Assignee set to Koen Deforche
  • Target version set to 3.3.0

Hey,

Bootstrap is indeed a bit aggressive with styling their inputs. The solution is to do:

view->addStyleClass("form-horizontal");

Regards,

koen

Actions #2

Updated by Alan Finley over 10 years ago

That doesn't change anything. The delegate widget still doesn't fit into the cells.

Actions #3

Updated by Koen Deforche over 10 years ago

It works here:

http://www.webtoolkit.eu/widgets/graphics-charts/category-chart

So there's got to be some other difference?

koen

Actions #4

Updated by Alan Finley over 10 years ago

It doesn't work. WTableView has the "form-horizontal" class by default. But even if I add it manually it still doesn't help.

Here's my example:

Wt::WApplication*
createApplication(const Wt::WEnvironment& env)
{
    Wt::WApplication *app = new Wt::WApplication(env);

    app->setTheme(new Wt::WBootstrapTheme(app));

    Wt::WStandardItemModel *model = new Wt::WStandardItemModel(app);
    for (int i = 0; i < 10; ++i)
    {
        std::vector<Wt::WStandardItem*> row;

        for (int j = 0; j < 5; ++j)
        {
            Wt::WStandardItem *item = new Wt::WStandardItem;
            item->setText(Wt::WString("{1}/{2}").arg(i).arg(j));
            item->setFlags(Wt::ItemIsEditable);
            row.push_back(item);
        }

        model->appendRow(row);
    }

    Wt::WTableView *view = new Wt::WTableView;
    view->addStyleClass("form-horizontal");
    view->setModel(model);
    view->setEditTriggers(Wt::WAbstractItemView::SingleClicked);
    view->setRowHeight(28);
    view->setItemDelegate(new Wt::WItemDelegate(view));

    app->root()->addWidget(view);

    return app;
}

I use Wt 3.3.1.

Actions #5

Updated by Alan Finley over 10 years ago

I don't know why the delegate's layout sets left and top margins for the editor.

Actions #6

Updated by Alan Finley over 10 years ago

If I reimplement the WItemDelegate::createEditor method and return a WComboBox as an editor, it has correct size and postion.

Actions #7

Updated by Koen Deforche over 10 years ago

  • Target version changed from 3.3.0 to 3.3.2

Hey,

It seems recent browsers no longer suffer from a bug which we were working around. Different browser versions explain the consequente confusion, but I finally see what you see and I've got a fix ready.

Regards,

koen

Actions #8

Updated by Alan Finley about 10 years ago

Koen Deforche wrote:

It seems recent browsers no longer suffer from a bug which we were working around. Different browser versions explain the consequente confusion, but I finally see what you see and I've got a fix ready.

Can I see a patch or a link to Github?

Actions #9

Updated by Koen Deforche about 10 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF