Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Gustavo on Jul 29, 2009 20:37
open dhtmlx forum
Problem with enableAltercss()

Hello,

i have a html table that I use the dhtmlx_grid to get the grid. Thatīs everthing fine, loading data from the html table, but there is something strange with the enableAltercss().

When I get at the jsp the grid doesnt appear with the css styles, but when i click in headers, the css styles works...
what should i do to make it load with the grid always ??

Answer posted by dhxSupport on Jul 30, 2009 01:22
Could you please provide any kind of sample where we can reproduce this issue?
Answer posted by Gustavo on Jul 30, 2009 15:07
Ok, it´s very simple:

at the JSP page:

<c:if test="${not empty objects}">
                        <table name="higieneTable" class="dhtmlxGrid" gridWidth="800px" gridHeight="300px" oninit="configGrid(higieneTable);" style="display:none">
                            <tr>
                                <td align="left" width="50px" type="ro"><img src="<c:url value="/scripts/dhtmlxgrid/imgs/icons_books/books_cat.gif"/>" title="Editar"/></td>
                                <td align="left" width="200px" sort="str" type="ro"><strong><fmt:message key="global.label.nome"/></strong></td>
                                <td align="left" width="150px" type="ro"><strong><fmt:message key="global.label.unidade"/></strong></td>
                                <td align="left" width="200px" type="ro"><strong><fmt:message key="global.label.funcao"/></strong></td>
                                <td align="left" width="*" type="ro"><strong><fmt:message key="global.label.produto"/></strong></td>
                            </tr>
                            <s:iterator value="objects" id="list"><tr><td align="center"><a href="<c:url value='/admin/higieneOcupacional.htm?id=${list.id}'/>"><img src="<c:url value="/scripts/dhtmlxgrid/imgs/icons_books/books_cat.gif"/>" border="0" title="Editar"/></a></td><td align="center">${list.nome}</td></tr></s:iterator>
                        </table>
                    </c:if>

at the JS file:

function configGrid(tableName) {
    tableName.setSkin("xp");
    tableName.enableEditTabOnly(true);
    tableName.setMultiselect(true);
    tableName.enableMultiline(true);
    tableName.setImagePath("../scripts/dhtmlxgrid/imgs/");
    tableName.enableTooltips("true,true,true,true,true");
    //tableName.selectRow(0);
    tableName.attachHeader("#rspan,#text_filter,#text_filter,#text_filter,#text_filter");
    tableName.enableAlterCss("uneven","");
    tableName.enableRowsHover(true,'grid_hover')
    tableName.setSizes();
}
Thanks!
Answer posted by Gustavo on Jul 30, 2009 15:10
Just to illustrate i send the images of before & after (clicking at any header)
Attachments (2)
after.JPG34.45 Kb
before.JPG33.97 Kb
Answer posted by dhxSupport on Jul 31, 2009 01:42
To fix this issue you should call enableAlterCss() method before grid initialization:
<table name="higieneTable" class="dhtmlxGrid" gridWidth="800px" gridHeight="300px" onbeforeinit="configGrid(higieneTable);" style="display:none">
Answer posted by Gustavo on Jul 31, 2009 07:30
Thanks! I had tried to execute just the enableAlterCss() ate onbeforeinit() but doesnt worked, but everything works!

I have another question, is not actually a problem cause probably i wont need to use this for now, but is something interesting to discover the solution, here we go:

at this point... if i do this :

<s:iterator value="objects" id="list"><tr><td align="center"><a href="<c:url value='/admin/higieneOcupacional.htm?id=${list.id}'/>">${list.nome}</a></td></tr></s:iterator>

this makes the ${list.nome} result a link... ok, that´s fine. But if I use head filter, when i put some character there, it filters everything inside the <td></td> includiing the link URL.
if i digit "higieneOcupacional" the head filter find this as it had been written at the rows... 

thanks!!

Answer posted by Gustavo on Jul 31, 2009 08:00
Another little issue:

I´m trying to change the selected row background color of my grid, my <style> code at JSP is:

div.gridbox_xp table.obj tr.rowselected td.cellselected, div.gridbox table.obj td.cellselected {
        background-color:#4682B4;
    }
    div.gridbox_xp table.obj tr.rowselected td {
        background-color:#4682B4;
        color:black;
    }

But it´s not overriding the original css file... i can see at firebug...
what should i do ?
thanks!!
Answer posted by dhxSupport on Aug 03, 2009 05:56
>>if i digit "higieneOcupacional" the head filter find this as it had been written at the rows... 
Please check this article http://dhtmlx.com/docs/products/kb/index.shtml?cat=search&q=3344&ssr=yes&s=filter%20link
>>But it´s not overriding the original css file... i can see at firebug...
Unfortunately we cannot reproduce is. Style of the selected row and cell has allways the highest priority.