Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Tejas Shah on Aug 12, 2008 02:47
open dhtmlx forum
DHTMLX Grid : Move data only while moving column

Hi,
I want to move just data when I move the whole column; the header label should remain same at their place. How can I do this ???
Answer posted by Support on Aug 12, 2008 04:57
You can use onBeforeCMove event, which occurs when column moved to new position

mygrid.attachEvent("onBeforeCMove",function(oldInd,newInd){
    // any custom code to move data here
    return false;
});
Answer posted by Tejas Shah on Aug 28, 2008 07:11
Hi,
    I used following for changing the header name after moving the column.

libTableGrid.attachEvent("onAfterCMove",function(oldInd,newInd){
                                              
                                               for (var i=1; i<=libTableGrid.getColumnsNum(); i++)
                                                {
                                                    libTableGrid.setColumnLabel(i, String.fromCharCode(asciiCode));
                                                    asciiCode++;      
                                                }    
                                                
                                        return false;
                                    });

But After moving column for the first time, it stops moving of the column.
How ?? Please Help.
Thanks in advance.
Answer posted by Support on Aug 28, 2008 07:59
The same code works as expected in case of local samples
The snippet which you are using has two possible problems
>>  for (var i=1; i<=libTableGrid.get
The column indexes started from 0, so first column will not be affected

>>  asciiCode++;  
You never reset this var to initial value, so labels will be different each time. 

If necessary I can send working sample with the same code.
Answer posted by Tejas Shah on Aug 28, 2008 09:54
Hi,
    Yeah please send the sample file with the same code.
Answer posted by Support on Aug 28, 2008 10:28
Sample sent by email. 
Answer posted by Tejas Shah on Aug 29, 2008 02:03
Hi,
    I still haven't received the working sample.
    Please send it.
    My Email : ejash1983@gmail.com
Answer posted by Support on Aug 29, 2008 02:06
If you still doesn't receive email with a sample, please contact us directly at support@dhtmlx.com