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

[SOLVED] Transposed tables #8

Closed
pubmania opened this issue Jun 23, 2020 · 7 comments
Closed

[SOLVED] Transposed tables #8

pubmania opened this issue Jun 23, 2020 · 7 comments
Labels
enhancement New feature or request

Comments

@pubmania
Copy link

pubmania commented Jun 23, 2020

SOLVED

I was wondering if it is possible to have an enhancement on tables and dynamic-tables whereby Columns and rows are interchanged. I checked on stackoverflow and it is possible to do it using just css as per this post so I tried to give it a go but it only works partially.

I am assuming it is perhaps down to something minor but I am not knowledgable enough to work out what. Would you be able to either include it as a style or perhaps provide some guidance on this please?

@kookma kookma added the enhancement New feature or request label Jun 24, 2020
@kookma
Copy link
Owner

kookma commented Jun 24, 2020

@pubmania
Many Thanks! Good suggestion, I add it to todo list and will implement it hopefully for next release!
But I think I had to rewrite the dynamic-table code I am not sure if css can transpose the table!

There are loops to iterate on tiddlers and create one row at a time! Now I have to iterate on fields instead of tiddlers!
So, it take times and needs rewrite the dynamic table codes

@pubmania
Copy link
Author

See the thing is I used that stackoverflow css solution on TW-Shiraz demo site and it did work in transposing the rows but problem was that it did not align the column headers transposed as rows with rest of the cells... once I am on the laptop later today, I will post the css change I applied on the demo site to make it work.... seeing that might trigger an idea perhaps.

@kookma
Copy link
Owner

kookma commented Jun 26, 2020

@pubmania
The issue is not related to css, the issue is the way rows are populated in the code

@pubmania
Copy link
Author

pubmania commented Jun 26, 2020

hmm you ofcourse know better so I can't add much value but see what I mean in screenshots below after I added a style called table-custom on stylesheet:

.table-custom, 
.table-custom thead td, 
.table-custom th, 
.table-custom td{
  display: block;
} 
.table-custom tr{
  display: block; 
    float: left;
}

image

Then on a new tiddler I used following macro call:

<<table-dynamic filter:"[tag[sample]]" fields:"title fa fb email created tags" stateTiddler:"exmp02" class:"table-custom thead-dark" caption:"''Table 2. Dynamic table example''">>

The columns were all changed to rows as shown below:

image

Problem as I mentioned before is the header is not aligned to rest of the data. Now this I did was quick and dirty but when I was doing it last time i managed to apply css such if "table-custom" was not applied to a table it remained like a normal table. I changed the css such that only table with table-custom css applied will be impacted.

image

I also checked and editing deletion all works perfect - just the alignment that is screwed up :(.

@pubmania
Copy link
Author

pubmania commented Jul 1, 2020

Hey I did it with custom CSS. 😃

I added the following style in the system tiddler: $:/plugins/kookma/shiraz/styles/tables

(The only thing missing in previous time was .table-custom thead, as I don't think .table-custom tbody td, is adding any value but I just left it there just in case.)
EDIT 1: Included .table-custom caption too as that ensures caption is also displayed properly.

.table-custom, 
.table-custom thead,
.table-custom caption,
.table-custom thead td,
.table-custom thead tr,
.table-custom tbody td,
.table-custom th, 
.table-custom td{
  display: block;
} 
.table-custom tr{
  display: block; 
    float: left;
}

and then when I call with following macro on a new tiddler:

<<table-dynamic filter:"[tag[sample]]" fields:"title fa fb email created tags" stateTiddler:"exmp02" class:"table-custom thead-dark">>

I get the transposed table:

shiraz_tiddlywiki_transpose_table

@pubmania pubmania changed the title [Enhancement Request] Transposed tables [SOLVED] Transposed tables Jul 2, 2020
@pubmania pubmania closed this as completed Jul 2, 2020
@kookma
Copy link
Owner

kookma commented Jul 3, 2020

@pubmania
Many thanks for your efforts. I will consider to add this in new release! I am very busy now and hopefully I will find time to do it.
I will write you then to see how we can add this in an optimum way!

@pubmania
Copy link
Author

pubmania commented Jul 4, 2020

@kookma you are very kind and I do not believe I am worthy of thanks from the creator of the tool.

All thanks are only for your hard work and generosity to share these tools.

I will be glad to help in anyway I can. :)

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

No branches or pull requests

2 participants