:: Forum >>

Setting column styles dynamically

Hi,
Is it possible to set the style class of a column dynamically to anything
other than .aw-column-x?
I'm redrawing the grid with different column names after certain events and using
grid.getCellTemplate(i).setClass(name, value) just isn't appropriate for what I'm doing.

I've tried
grid.getCellTemplate(i).className = "new-class-name"
but it doesn't work.

Thanks in advance,
BT
BT
Tuesday, November 1, 2005
Hi,
Still wondering if anyone has a solution for this? ...Alex?

Apply a css selector to a column when building the grid dynamically??
Why isn't there a method obj.seClass(name) where name is the name of the
css selector?
I would really like to use this grid...in a commercial app.

Thanks

p.s. Any idea when a full documentation suite will be available?
BT
Wednesday, November 2, 2005
Is your grid inside another HTML element or are you drawing it right to the document with a document.write(grid) type statement? There are issues with CSS if the grid is inside another object on the page.

I currently do use this in a commercial application and have over 1000 users on it all day every day. It has performed (the app is still on 1.x) perfectly the entire year. And I am overly excited about the features of 2.x and how easy it is to create new controls with it. Once the few bugs get worked out of the beta code, this is going to be an outstanding product!

p.s. - the sourcecode that is in the QuickRef folder should give you everything you need to know about the controls. What do you think is missing from the documentation now? I think one thing I see missing might be knowing the names of the templates that are available to manipulate via getTemplate("").
Jim Hunter
Wednesday, November 2, 2005
Thanks for the reply Jim.
I'm writing the grid contents to a <DIV>. I tried as you suggested to write to the main document but no luck...(but I don't want to do that anyway)

I really just want to mimick the behaviour of setting the HTMLElement.className property. I don't want to be limited to using the pre-defined selectors aw-column-0...aw-column-n when applying styles to my columns at creation time as the styles of columns will constantly change. Surely this has come up before with people implementing dynamic grids?

With regard to documentation. The docs on the web site are out of date. I'm sorry but "source code in the QuickRef folder" doesn't cut it for me when I'm going to spend $1,500 on a piece of software! I realise that version 2 is still in Beta1 but I would hope that at full release time all source code will be fully documented.

Perhaps the activewidgets team could take a look at this tool for generating 'javadoc like' documentation from javascript source.
http://jsdoc.sourceforge.net/

Again, I think this is a great toolkit!!! However, as a commercial toolkit it needs polishing in my opinion.

Thanks,
BT
BT
Friday, November 4, 2005
Like I said earlier, my entire application is dynamic and I do change CSS rules on the fly if needed. I wrote (modified something I found on the web) a function that allows me to simply call a function to change any attribute of a CSS rule. So you could, on the fly, make the call and tell it to change the font color of .aw-column-3 if needed. This was easy enough to do and the code is all over the web.

Do you understand how Alex uses the CSS classes with regard to the AW objects? I ask that because it's not real apparent. I think it would be good for Alex to write up a brief explanation of it and post it for everyone. But what I have done is create my own CSS classes and I assign them to the objects that I create, something like this:

<style>
.aw-swep-button {
background-color : #B9CDE1;
text-align : center;
vertical-align : middle;
}
.aw-swep-edit {
background-color : lightyellow;
}
.aw-alert-urgent {
color : red;
}
</style>

then when I create a AW.HTML.BUTTON I assign my class with setClass("swep", "button") and make it red by adding setClass("alert", "urgent"). This is how I have been handling it in 2.x, I did everything in 1.x with the CSS Class modification function that I have.

As for the docs, I think we disagree a little. First, I don't expect the web be to "up to date" as I would rather have the code being worked on and not the web site until the code is done. At that point I would expect the web site to "catch up". And as for the source code, I have never expected any software that I buy to have fully commented source. What I do expect is to be provided with documentation that gives me enough information to use every method and property of all objects and give real world examples to show these methods and properties in use. I have been writing software for over 25 years and I believe in code first, documentation second. My priority is delivering working code. The better the code works, the less documentation you need. That thought process does not 100% apply to toolkits since you need docs in order to use then to their fullest.
Take a closer look at the samples that are in the QuickRef folder. The source is commented and it shows most of the methods and properties available. This is a very good start and you should not need too much more information (I agree that there are still some missing properties and methods) to make things happen. The reason I disagree on the fully commented source code of the toolkit is because when I buy a toolkit, I want to know 'what' a method does, I don't need to know everything about 'how' it does it. That is the difference between good docs and commented source code.

And we do agree that this is a great toolkit and it will only get better.
Jim Hunter
Friday, November 4, 2005

This topic is archived.


Back to support forum

Forum search