View Full Version : grid issues
scotthathaway
11-02-2004, 01:50 AM
Thanks for making Laszo open source!
I have two problems with the grid that I need some help with.
1. I want to center the text in one of the columns. How do I do this?
2. The grid does a nice mouseOver highlight of the row as you move the mouse over it by default. I like this. When you add an onClick event to a single cell, the mouseOver stops working in that cell (but the onClick does process). How can I get an onClick but keep the default mouseOver?
Thanks,
Scott
rajs1
11-02-2004, 02:59 AM
1.
If you use the gridcolumn and use a text element inside it, I guess you can use the alignment parameters inside the text element to do whatever.
<grid datapath="results:/result" width="450" height="130" multiselect="false">
<gridcolumn width="370">Description
<text datapath="@description" />
</gridcolumn>
<gridcolumn width="80">Price
<text align="right" datapath="@price" />
</gridcolumn>
</grid>
2.
I normally use the onselect event inside the grid. With this method, I find that the row I clicked on is highlighted (in a deeper colour) and the mouse over highlight still continues to work (in a lighter colour). You can get individual data elements using the datapointer.
In the above example since the multiselect="false", I use the following code
<method event="onselect">
<![CDATA[
var id = this.getSelection().p.attributes.id;
...
If multiselect="true", I would have had to (in order to process the 1st clicked row,i.e the 0th row):
<method event="onselect">
<![CDATA[
var sel = this.getSelection();
var dp = sel[0];
var id = dp.p.attributes.id;
...
Hope this helps.
Cheers
-raj
scotthathaway
11-09-2004, 06:55 AM
Raj,
Thanks for the reply.
I cannot get either of them to work. Using the align=center attribute on the text in the column centers the data in entire grid, not just in the column. I cannot get text centered in the column.
On the other issue, trying the
var id = this.getSelection().p.attributes.id;
gives an error. What is 'p' in this code?
Thanks,
Scott
------------------------------------
1.
If you use the gridcolumn and use a text element inside it, I guess you can use the alignment parameters inside the text element to do whatever.
code:--------------------------------------------------------------------------------
<grid datapath="results:/result" width="450" height="130" multiselect="false">
<gridcolumn width="370">Description
<text datapath="@description" />
</gridcolumn>
<gridcolumn width="80">Price
<text align="right" datapath="@price" />
</gridcolumn>
</grid>
--------------------------------------------------------------------------------
2.
I normally use the onselect event inside the grid. With this method, I find that the row I clicked on is highlighted (in a deeper colour) and the mouse over highlight still continues to work (in a lighter colour). You can get individual data elements using the datapointer.
In the above example since the multiselect="false", I use the following code
code:--------------------------------------------------------------------------------
<method event="onselect">
<![CDATA[
var id = this.getSelection().p.attributes.id;
...
--------------------------------------------------------------------------------
If multiselect="true", I would have had to (in order to process the 1st clicked row,i.e the 0th row):
code:--------------------------------------------------------------------------------
<method event="onselect">
<![CDATA[
var sel = this.getSelection();
var dp = sel[0];
var id = dp.p.attributes.id;
...
--------------------------------------------------------------------------------
Hope this helps.
Cheers
-raj
rajs1
11-09-2004, 10:25 AM
I cannot get either of them to work. Using the align=center attribute on the text in the column centers the data in entire grid, not just in the column. I cannot get text centered in the column.
That is a bit strange. Can you post an example grid (small example preferably) so that it can be tried out?
On the other issue, trying the
var id = this.getSelection().p.attributes.id;
From the Laszlo reference documentation, p stands for
The LzDataNode that the datapointer is pointing to.
See "datapointer" under the "Tags" tab in the reference documetation for more details. Again, post some code if you want to.
Hope this helps.
Cheers
-raj
rajs1
11-21-2004, 01:28 AM
I thought my alignment within a grid column worked but how wrong was I!
So yes your post on aligment within a grid column is still a valid question.
I suspect this is a Laszlo "feature" (as one big software company tends to call its bugs), to which there is no answer.
I say this because there has been another query on this (http://www.laszlosystems.com/developers/community/forums/showthread.php?threadid=1056&highlight=align) but there has been no answers from any Laszlo developers. Such a pattern (I noticed) means that no one knows what the answer is.
Cheers
-raj
You'll want to extend basegridcolumn (http://www.laszlosystems.com/lps/docs/lzx-reference/index.html) for this.
<basegridcolumn>
<text placement="header" align="center">Centered column header</text>
The
basegrid (http://www.laszlosystems.com/lps/docs/lzx-reference/index.html)
example may be helpful as well.
vBulletin® v3.8.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.