Initial sort on dataGrid/.NET Connector

Hi,

I can set the first column to sort descending on load, but it will lock the grid and won’t be able to change the sorting on clicking the headers. If I remove the “&dhx_sort[0]=des”, the grid can resort again by clicking the headers. Is there a way to have the grid sort descending for first column only on first load?

If “mygrid.sortRow(0, “connector”, “des”);” is added to the code, the data doesn’t load until a header is clicked.

<script>
        
        mygrid = new dhtmlXGridObject('gridbox');

        mygrid.setHeader("ID, Customer, Assembly Number, Revision, Work Order, Due Date, New Job, Repeat (no changes), Repeat (w/ changes), Rework, Requested By, Requested Date, Received By, Received Date, Released By, Released Date");
        mygrid.attachHeader("#connector_text_filter,#connector_text_filter,#connector_text_filter,#connector_text_filter,#connector_text_filter,#connector_text_filter,#connector_text_filter,#connector_text_filter,#connector_text_filter,#connector_text_filter,#connector_text_filter,#connector_text_filter,#connector_text_filter,#connector_text_filter,#connector_text_filter,#connector_text_filter");
        mygrid.setInitWidths("50,150,150,50,50,100,50,50,50,50,100,100,100,100,100,100");
        mygrid.setColTypes("edtxt,edtxt,edtxt,edtxt,edtxt,edtxt,edtxt,edtxt,edtxt,edtxt,edtxt,edtxt,edtxt,edtxt,edtxt,edtxt");
        mygrid.setColSorting("connector,connector,connector,connector,connector,connector,connector,connector,connector,connector,connector,connector,connector,connector,connector,connector");
        mygrid.enableSmartRendering(true);
        mygrid.enableMultiselect(true);
        mygrid.init();
              
        //mygrid.setSortImgState(true, 0, "des");

        mygrid.loadXML("connectorPPR.ashx?dynamic=50&dhx_sort[0]=des");
                
        var dp = new dataProcessor("connectorPPR.ashx?dynamic=50");
        dp.init(mygrid);

    </script>

You can set the initial URL like next

connectorPPR.ashx?connector=true&dynamic=50

The part after “connector=true” will be replaced during the further calls, so grid will be able to reload self with a different sort settings.

Works perfectly, thank you