d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Dropdown Menu To Select Table Size
Add Reply New Topic New Poll
Member
Posts: 22,605
Joined: Sep 23 2007
Gold: 1.01
Warn: 40%
Jun 26 2012 06:53pm
Hi :)

Would like to add a dropdown menu to my site where users can select the amount of columns and rows for inserting a table.
Should work similar to the table dropdown menu in libreoffice writer.
I know how to do the grabbing which cell has been clicked, this is already done with javascript.

What I need to know is:
How can I make it appear like on this screenshot?

I'm not sure if this is even possible, since it will have to work for any amount of rows and any amount of columns being selected (will be limited, but within the limits it has to work for any amount).
It's not a big problem if that is not possible, but it would be nice to have.

Thanks :)

This post was edited by tcl on Jun 26 2012 06:55pm
Member
Posts: 2,736
Joined: Nov 28 2009
Gold: 34.00
Jun 26 2012 09:42pm
It'll be hard to do anything but do it for you unless you specify exactly where you're stuck. Or maybe that's what you are asking for - for someone to do it for you? :rolleyes:
Member
Posts: 2,736
Joined: Nov 28 2009
Gold: 34.00
Jun 26 2012 10:13pm
Logically, you'll want to check row and cell number for hovered cell (which you have on your screenshot) and (for example) apply a class (.selected) for everyone of those cells.

for example, paint out the table:

Code
var w=10, h=15, sW = 7, sH = 9;
for(i = 0; i < h; i++)
  write out <tr>

  for(j = 0; j < w; j++)
     write out <td>

     if(i < sW && j < sH) class = selected


This post was edited by eagl3s1ght on Jun 26 2012 10:14pm
Member
Posts: 2,736
Joined: Nov 28 2009
Gold: 34.00
Jun 27 2012 03:18am
I was bored.

Member
Posts: 22,605
Joined: Sep 23 2007
Gold: 1.01
Warn: 40%
Jun 27 2012 05:19am
Quote (eagl3s1ght @ 27 Jun 2012 11:18)
I was bored.

http://2.imgland.net/nuJ_MZ.png


Well, that is basically what I want, but without javascript ;)
Seems this is impossible, but I wanted to ask anyway.
Will probably do it with js since the whole editor uses js anyway.

Thanks :)
Member
Posts: 2,736
Joined: Nov 28 2009
Gold: 34.00
Jun 27 2012 06:00am
Quote (tcl @ 27 Jun 2012 13:19)
Well, that is basically what I want, but without javascript ;)
Seems this is impossible, but I wanted to ask anyway.
Will probably do it with js since the whole editor uses js anyway.

Thanks :)


LOL what are you going to code it in then, xml? Your foolness is stunning.
Member
Posts: 13,630
Joined: Dec 4 2009
Gold: 0.00
Jun 27 2012 10:19am
Quote (tcl @ Jun 27 2012 04:19am)
Well, that is basically what I want, but without javascript ;)


So... you want client-side operations that will require logic to complete, but you don't want to use a programming language to do it?

gl hf gg no re
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll