hi, Mario:
In my way, I always setData like below:
model_->setData(row, col_, value);
// set the row as DbRowRole when set value.
model_->setData(row, col_, row, DbRowRole);
and then get the row of DbRowRole:
void PList::selected(const WModelIndex& index) {
int row = boost::any_cast<int>(index.data(DbRowRole));
pb_ = pv_[row];
}
the pb_ is a Project and pv_ is a std::vector<Project>.
BR
Zhimin
2011/8/15 <[email protected]>
> Hi, my name is Mario Diethelm. I am a C/C++ programmer making my first
> steps
> in the field of Web applications.
>
> I have started to work with Wt a couple of months ago. I am building an
> application
> that needs to load rows of data from a data base and present it on the
> browser.
> I am using a WStandardItemModel to load the actual data and a WTableView
> to display it. The user then must select one of the records available to
> make some process based on the data selected.
>
> The question is: how do I identify the selected record? I do not have
> problems
> loading the data into the WStandardItemModel, or presenting it on the
> screen,
> using the WTableView widget. Even more, in a row basis, I can select the
> required record but I can not realize how to identify it and access the
> actual
> data in my program. I have been looking the Class Reference and source code
> examples but I can not find a way to recognize the "current selected
> record"
> neither how to manage it inside the application.
>
> I would appreciate if somebody could give me some advice. I am using Wt
> 3.1.7.
>
> Thanks and regards.
>
> Mario Diethelm.
>
>
>
>
> ------------------------------------------------------------------------------
> uberSVN's rich system and user administration capabilities and model
> configuration take the hassle out of deploying and managing Subversion and
> the tools developers use with it. Learn more about uberSVN and get a free
> download at: http://p.sf.net/sfu/wandisco-dev2dev
> _______________________________________________
> witty-interest mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/witty-interest
>
--
我的博客:hi.baidu.com/zhmsong;
我的项目:sf.net/projects/cxserver <http://sourceforge.net/projects/cxserver/>
------------------------------------------------------------------------------
uberSVN's rich system and user administration capabilities and model
configuration take the hassle out of deploying and managing Subversion and
the tools developers use with it. Learn more about uberSVN and get a free
download at: http://p.sf.net/sfu/wandisco-dev2dev
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest