Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get selected row in tableview #1

Open
reto-ineichen opened this issue Sep 23, 2012 · 10 comments
Open

Get selected row in tableview #1

reto-ineichen opened this issue Sep 23, 2012 · 10 comments

Comments

@reto-ineichen
Copy link

tablewview,js looks very nice, but how can I get the index of the row which was selected with a checkbox?

Is it possible to get the data in this row by cell?

@frequent
Copy link
Owner

hm... been a while since I did this demo.

In the linked example, where the checkboxes are created automatically, each checkbox has an id like selectRow-1, selectRow-2, ... so you could extract the row number(s) from the checked checkboxes. This would give you the rows.

To get a cell value in a specific row, you could check for the target cells' headers attribute, which is used to toggle columns and contains the id of the column (= in column 1, header cell id = co-1, all cells in this column have headers=co-1)

id=co-0            id=co-1           id=co-2
selectRow-1   headers=co-1      headers=co-2
selectRow-2   headers=co-1      headers=co-2
selectRow-3   headers=co-1      headers=co-2
selectRow-4   headers=co-1      headers=co-2

For example:
Say you know the row and need the 5th cell in this row, which contains a value for "price". If this column is named "price" you need to loop through all column header cells and check if the column text() is "price". This will give you the column header cell. Then select the id of this header cell (will be co-5, as it's the 5th column). Then find the cell in your selected row whose headers attribute equals co-5 (header cell id). That should give you the correct cell. Then get it's value via text().

@ptrstpp950
Copy link

Are you planning to upgrade/change this demo? It is really interesting.

@frequent
Copy link
Owner

you mean update in terms of latest JQM?

@ptrstpp950
Copy link

If it will be possobile :) It is great plugin. I was also thinking about
datatables, but this looks much better on my mobile and desktop.

On Mon, Sep 24, 2012 at 2:03 PM, Sven Franck [email protected]:

you mean update in terms of latest JQM?


Reply to this email directly or view it on GitHubhttps://github.com//issues/1#issuecomment-8816516.

@frequent
Copy link
Owner

I happen to have made a tableview-datatables version, too :-)

Give me some time. Need to catch a deadline Thursday, afterwards I should be able to try and commit something here.

@ptrstpp950
Copy link

Great. Thanks a lot.

On Mon, Sep 24, 2012 at 3:00 PM, Sven Franck [email protected]:

I happen to have made a tableview-datatables version, too :-)

Give me some time. Need to catch a deadline Thursday, afterwards I should
be able to try and commit something here.


Reply to this email directly or view it on GitHubhttps://github.com//issues/1#issuecomment-8817906.

@ptrstpp950
Copy link

Do you have source code of using datatables in JQM?

On Mon, Sep 24, 2012 at 3:12 PM, Piotr Stapp [email protected] wrote:

Great. Thanks a lot.

On Mon, Sep 24, 2012 at 3:00 PM, Sven Franck [email protected]:

I happen to have made a tableview-datatables version, too :-)

Give me some time. Need to catch a deadline Thursday, afterwards I should
be able to try and commit something here.


Reply to this email directly or view it on GitHubhttps://github.com//issues/1#issuecomment-8817906.

@frequent
Copy link
Owner

You can see my answer on SO here

@ptrstpp950
Copy link

Unfortunattley it works strange during Ajax load in JQM

On Mon, Sep 24, 2012 at 5:23 PM, Sven Franck [email protected]:

You can see my answer on SO herehttp://stackoverflow.com/questions/10386821/mobile-data-entry-mobile-friendly-datagrid


Reply to this email directly or view it on GitHubhttps://github.com//issues/1#issuecomment-8822554.

@frequent
Copy link
Owner

wait for the example. Works fine here, no matter if on first or subsequent pages both with static-updating and ajax-server-side updating.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants