473,385 Members | 1,712 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Can I aggregate divs?

18
Hi there,

Iīm writting a program that simulates an ER model. Iīve managed to draw the entities and relations but Iīm stuck now...
I drew the relations using "wz_jsgraphics.js" lib from http://www.c-point.com/javascript_vector_draw.htm .

My problem now is that this lib draws lines by creating tons of divs and combining them together, fact that doesnīt meet my goals, because I wanted to turn the relation "draggable" (with dragdrop lib from YUI). Because I have tones not just one div per relation, I cannot turn them draggable. I tryed to insert them into a collection of draggable objects and go from there, but not only the divs are created with no id, but also I canīt determine how many are there in each relation...

Any ideas to go around this would be greatly welcome.
Thanks
Nov 28 '07 #1
5 998
acoder
16,027 Expert Mod 8TB
I'm not familiar with the graphics library in question, but why can't you determine the number of divs in a relation?

The id problem is not difficult. You could just set them.
Nov 28 '07 #2
Nibbus
18
Hi acoder,

As far as I can tell, this lib uses the same method of other various drawing libs to draw a line. Pixels are painted by creating small background-colored layers (DIV elements), and arranging these to the desired pattern.

The reason I canīt count the divs created is because theyīre created on the fly by the function drawLine(x1 , y1 , x2, y2), being in cache until paint( ) is called, function which actually draws them. I analised the code generated using IEDeveloper toolbar, in which I can see the elements created, dozens of them, all without id, just a tag and itīs height ,width and bg color.

If there was a mean of putting them as just one div element would permit me identifying each relation arrow, letting me turn the element draggable.

Here is some code to elucidate you:

Expand|Select|Wrap|Line Numbers
  1. function drawLinks()
  2.        {    
  3.             var jg = new jsGraphics("dropZone");
  4.             for (var i = 0; i < oProcess.length ; i++)
  5.             {                
  6.                 var el = oProcess[i].procCode;
  7.                 var currentX = getProcessPositionX(el);
  8.                 var currentY = getProcessPositionY(el);
  9.  
  10.                 for (j = 0; j < oProcess[i].procFinish.length ; j++)
  11.                 {
  12.                     var nextEl = oProcess[i].procFinish[j];
  13.                     var nextX = getProcessPositionX(nextEl);
  14.                     var nextY = getProcessPositionY(nextEl);
  15.  
  16.                     jg.drawLine(currentX - 242, currentY - 188, nextX - 242, nextY - 188);     //those number are just because of the offset
  17.                     jg.setStroke(2);  //pencil thickness
  18.  
  19.                 }
  20.              }
  21.              jg.paint();
  22.              alert("Iīm done!");
  23.          }            
  24.  
  25.  
Thanks for your attention and time
Nov 29 '07 #3
acoder
16,027 Expert Mod 8TB
Can you determine where these DIV elements are created? Are there within a parent element or just appended to the body?

You can use getElementsByTagName("div") to get the divs. If you can then determine which ones are the divs, then you can make a collection out of them.
Nov 29 '07 #4
Nibbus
18
Can you determine where these DIV elements are created? Are there within a parent element or just appended to the body?
Yes, theyīre being created inside another div called "dropZone" .


You can use getElementsByTagName("div") to get the divs. If you can then determine which ones are the divs, then you can make a collection out of them.
I tried that option, but the divs created to the relations are not the only divs inside dropZone, the divs representing the entities are also inside. Even selecting them (entity divs) by class,I still canīt select the other ones which donīt have any id...

Iīm so stuck in this that Iīm getting bored... maybe Iīll try another aproach, using an image to represent the relation or so... what do you say?

Once again, thank you for your time and cooperation
Nov 29 '07 #5
acoder
16,027 Expert Mod 8TB
I tried that option, but the divs created to the relations are not the only divs inside dropZone, the divs representing the entities are also inside. Even selecting them (entity divs) by class,I still canīt select the other ones which donīt have any id...
You don't need to select by id. Try
Expand|Select|Wrap|Line Numbers
  1. var divs = document.getElementById("dropZone").getElementsByTagName("div");
  2. // check not entity divs by checking class...
  3. // if you need ids, just set them for the divs
Nov 30 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

39
by: WindAndWaves | last post by:
Hi Gurus I have a page, which looks a bit like this: .... <body> <div ID=id1>................</DIV> <div ID=gsd>................</DIV> <div ID=ewd>................</DIV> <div...
2
by: Greg Stark | last post by:
I find I often want to be able to do joins against views where the view are aggregates on a column that has an index. Ie, something like SELECT a.*, v.n FROM a JOIN (select a_id,count(*) as n...
10
by: neb | last post by:
Dear member of the forum, Ms access has built-in aggregate function like: -Sum, Max, First, Avg, ... Is it possible to build user-defined aggregate? (if you have any clue, do not hesitate to...
3
by: MrNobody | last post by:
I've read that the expression property for DataColumns is used to "Sets or retrieves the expresssion used to filter rows, calculate the values in a column, or create an aggregate column.". I...
1
by: Najib Abi Fadel | last post by:
Hi i have an ordered table of dates let's say: 1/1/2004 8/1/2004 15/1/2004 29/1/2004 5/2/2004 12/2/2004
2
by: tasman.hayes | last post by:
I'm experimenting with converting a site from a table layout to CSS. I'm floating three DIVs in a row for the top of a website (a logo, navigation buttons and a email list signup box). The DIVs...
3
by: Raghu | last post by:
Hello all, Can somebody help me hopw to resolve teh probelm of aggregate initialisation in c++. Her eis the piece of code. #include<stdio.h> class MyTest { public:
2
by: Ian825 | last post by:
I need help writing a function for a program that is based upon the various operations of a matrix and I keep getting a "non-aggregate type" error. My guess is that I need to dereference my...
4
by: shapper | last post by:
Hello, I have the following Linq query: var q = (from p in database.Posts join pt in database.PostsTags on p.PostID equals pt.PostID join t in database.Tags on pt.TagID equals t.TagID group...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.