- This topic is empty.
-
AuthorPosts
-
October 19, 2015 at 5:37 am #209880
chandrabhan
ParticipantHi,
I am struggling to get an idea to fix this problem.
I have to display some data on screen. Now this data can be displayed in any form depending upon the settings in DB. Like Table or Grid.
So if I have to show data in grid it should look like:Name :——————[COL1, ROW1] LastName:——————[COL2, ROW1]
Address:————————————————-[COL1, ROW2]And for Table:
Name | LastName | Address |Now the issue is I cannot save Width as ‘%’ or ‘pixels’ in DB as it would not make any sense, so I chose to set them as relative weight(like Name-Width:1,LastName-Width:2,Address-Width:4), For table it works fine as I convert them to ‘width%’ at time of render, but for grid it dose not make any sense.
If there any other ideas to keep width in such a way that it can be controlled by DB for any or most of the possible layouts.
Thanks in advance.
October 19, 2015 at 6:49 am #209882Paulie_D
MemberThere’s a lot you could do if you can apply a class to a wrapper but without seeing what the output HTML is like.
October 19, 2015 at 6:59 am #209884chandrabhan
ParticipantThanks Paulie_D for the reply.
The output HTML is very accurate as you displayed.
The issue is I can save only a single value for name’s width in DB: either in pixels or in % or in relative weight.
In the given example:.table .name {
width: 25%;
}.grid .name {
width: 50%;
}The value is different in both case(25 and 50 viz), I wanted to store in DB such info, that at time of table it converted in 25% and in gird it gets converted to 50%
October 19, 2015 at 7:19 am #209885Paulie_D
MemberThe thing is that if you can add a class to the wrapper you don’t need store the value in the database at all….the CSS will deal with all of that.
October 19, 2015 at 9:22 am #209886chandrabhan
ParticipantDear Paulie_D
The issues with this approach is that the number of field and its order is not fix, they can very. Also used wants to provide the width for each field from DB so that he can control the layout according to various media type(Web, PDF and excel.)
So I need to put something for width in DB for these fields, and then transform the field as per various width(like in above example in case of table it should give 25% and in gird 50% )Or one option is that I can have two columns in DB(viz TableWidth and GridWidth) but it is not a very appreciated solution
October 19, 2015 at 9:28 am #209887Paulie_D
MemberThen I would suggest that this is not an easily solvable problem.
Certainly not with CSS…javascript might be an option.
There is no single property that will do this for you…providing two different layouts based on essentially the same CSS.
October 19, 2015 at 9:30 am #209888chandrabhan
ParticipantDear Paulie_D
Thanks for the reply.
For time being I will keep separate width per layout.It will do for now :-)
-
AuthorPosts
- The forum ‘CSS’ is closed to new topics and replies.