Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by dian.kwok on Sep 22, 2008 03:41
open dhtmlx forum
out of memory in IE when filtering grid

Hi team,

I'm creating a grid using pro v16 b80512.I'm trying to do server side filtering based on the big dataset example.
I'm using a custom header to do the filter.

here's my js code :

var sogrid;
function doInitGrid(gridname,pagingArea){
                
                sogrid = new dhtmlXGridObject(gridname);
                sogrid.imgURL = "codebase/imgs/";                 
                sogrid.enablePaging(true,10,null,pagingArea);
                sogrid.setSkin("light");
                sogrid.setPagingSkin("toolbar");                
                if (sogrid.setColspan)
                 sogrid.attachEvent("onBeforeSorting",customColumnSort)                
                sogrid.attachEvent("onEditCell",function(stage,id,ind){
                 return false;                
                });
                sogrid.init();             
                sogrid.attachEvent("onBeforePageChanged",function(){
             if (!this.getRowsNum())
                 return false;
             return true;
             })                
                sogrid.loadXML("xml/salesorder.xml");                                
}

function customColumnSort(ind){        
            var a_state = sogrid.getSortingState();
            window.s_col=ind;
            window.a_direction = ((a_state[1] == "des")?"asc":"des");
reloadGrid();
            return true;
}
function reloadGrid(){        
            sogrid.clearAndLoad("xml/salesorder.xml");            
            if (window.a_direction)
                sogrid.setSortImgState(true,window.s_col,window.a_direction);
}

here's my testing xml :

<?xml version="1.0" encoding="UTF-8"?>
<rows>
    <head>
        <column width="145" type="ed" sort="str">
            SO#
        </column>
        <column width="145" type="ed" sort="date">
            Order Date
        </column>
        <column width="145" type="ed" sort="str">
            Order Type
        </column>
        <column width="300" type="ed" sort="str">
            Customer
        </column>
        <column width="145" type="ed" sort="str">
            Customer PO
        </column>
        <column width="145" type="ed" sort="str">
            Project ID
        </column>
        <afterInit>
     <call command="enableHeaderMenu" />
<call command="attachHeader">

        <param><![CDATA[
                <input type='text' name='soNumberFilter' onclick='(arguments[0]||event).cancelBubble=true;'
onchange='reloadGrid;' style='width:90%; font-size:8pt; font-family:Tahoma;' />,
                <input type='text' name='orderDateFilter' onclick='(arguments[0]||event).cancelBubble=true;'
onchange='reloadGrid;' style='width:90%; font-size:8pt; font-family:Tahoma;' />,
                <select name='orderTypeFilter' onclick='(arguments[0]||event).cancelBubble=true;'
onchange='reloadGrid;' style='width:90%; font-size:8pt; font-family:Tahoma;'>
                    <option value=''></option>
                        <option value='a'>a</option>
                        <option value='b'>b</option>
                        <option value='c'>c</option>                         
                </select>,
                <input type='text' name='customerFilter' onclick='(arguments[0]||event).cancelBubble=true;'
onchange='reloadGrid;' style='width:90%; font-size:8pt; font-family:Tahoma;' />,
                <input type='text' name='cutomerPOFilter' onclick='(arguments[0]||event).cancelBubble=true;'
onchange='reloadGrid;' style='width:90%; font-size:8pt; font-family:Tahoma;' />,
                <input type='text' name='projectIDFilter' onclick='(arguments[0]||event).cancelBubble=true;'
onchange='reloadGrid;' style='width:90%; font-size:8pt; font-family:Tahoma;' />
            ]]>
        </param>
</call>
</afterInit>
    </head>
        <row id="0000000001">
            <cell>0000000001</cell>
<cell></cell>
<cell>a</cell>
            <cell>Customer One</cell>
            <cell></cell>
            <cell></cell>
</row>
    </rows>
    


my question is :
If i change the filter for example using the dropdown, the grid will reload from server side but when i click the dropdown again the IE will show this message : Out of memory in line :11 or Stack overflow in line 13.
the message is always appear so i have to force to close the IE.

but when i'm using firefox it seems ok except that after reloading from the server side the sorting won't work anymore.

is it a bug or there's an error in my code?

Thanks in advance.

dian
Answer posted by dhtmlx support on Sep 23, 2008 02:33
In order to reload grid select onchange event handler should be as follows:

<select name='orderTypeFilter' onclick='(arguments[0]||event).cancelBubble=true;'  onchange='reloadGrid();' style='width:90%; font-size:8pt; font-family:Tahoma;'>

instead of:

   <select name='orderTypeFilter' onclick='(arguments[0]||event).cancelBubble=true;' onchange='reloadGrid;' style='width:90%; font-size:8pt; font-family:Tahoma;'>

Also reloadGrid() function should send a request to a server-side program (not to the static xml) and pass values of input and select filters.

Answer posted by dian.kwok@gmail.com on Sep 23, 2008 02:46
well actually i already tried with
<select name='orderTypeFilter' onclick='(arguments[0]||event).cancelBubble=true;'  onchange='reloadGrid();' style='width:90%; font-size:8pt; font-family:Tahoma;'>

and my code originally using server side program in reloadGrid() function. And after testing it with the code above the error still the same.
Answer posted by dhtmlx support on Sep 23, 2008 08:56
We have tested the 50000_paging sample with select as a filter inside header. There are not any issues in this case.

If problem persists,  please, provide the sample where issue can be recreated  to support@dhtmlx.com


Answer posted by dian.kwok@gmail.com on Sep 23, 2008 21:22
Hi team,

I have search and re-test my code and finally I found out that if i combine the server side filtering and enableHeaderMenu it will cause the problem.
After i remove <call command="enableHeaderMenu" />  syntax in my XML the "out of memory" and "stack overflow " error dissapear.

Please advise for this error. Thanks.

dian.kwok
Answer posted by dhtmlx support on Sep 24, 2008 05:50
The issue still can not be reconstructed. Please,  contact us directly at the  support@dhtml.com  and we will send you  the sample (as hiding columns is the PRO edition feature).