Koen, Thanks for the simple example. That's very similar to what I wound up doing. Is there anyway to make the WTableview resize (stretch to fill) if it has more room in the browser window? I've been able to get it to fill the window, but this appears to break scrolling.
Craig Craig Miller http://spatialminds.com On Sep 4, 2012, at 11:39 PM, Koen Deforche wrote: > Hey Craig, > > See also the test case below. > > Regards, > koen > > #include <Wt/WStandardItemModel> > #include <Wt/WStandardItem> > #include <Wt/WContainerWidget> > #include <Wt/WTableView> > > using namespace Wt; > > int cols = 300; > int rows = 1000; > > class TestApp : public WApplication > { > public: > void createRow(std::vector<WStandardItem *>& row, int size, > const std::string& s) { > > row.clear(); > > for (int i = 0; i < size; ++i) { > WStandardItem *t > = new WStandardItem(s + " c" + boost::lexical_cast<std::string>(i)); > > row.push_back(t); > } > } > > WStandardItemModel *createModel() { > WStandardItemModel *model_ = new WStandardItemModel(0, cols, this); > > for (int i = 0; i < cols; ++i) > model_->setHeaderData(i, Horizontal, > "col " + boost::lexical_cast<std::string>(i)); > > std::vector<WStandardItem *> row; > > for (unsigned i = 0; i < rows; ++i) { > createRow(row, cols, "Item "+ boost::lexical_cast<std::string>(i)); > model_->appendRow(row); > } > > return model_; > } > > TestApp(const WEnvironment& env) : WApplication(env) > { > WTableView *tv = new WTableView(root()); > tv->setHeight(500); > tv->setModel(createModel()); > } > > void foo() { > } > > private: > }; > > WApplication *createApplication(const WEnvironment& env) > { > TestApp *app = new TestApp(env); > > return app; > } > > int main(int argc, char *argv[]) > { > return WRun(argc, argv, &createApplication); > } > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > witty-interest mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/witty-interest ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ witty-interest mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/witty-interest
