grid can't sorting

hi;
When I use grid appears when such as pictures described exception,When I click the grid tilte, can’t sorting, appear js exception,


It seems that you tries to use client side filtering for grid with dynamic loading.
Dynamically loaded grids can’t be sorted on client side, because not all data is available on client. If you are using connectors on server side, you can try to use server side sorting instead.

hi!
But I only need in the current page sorting, grid can do it, I only need to the current page data sorting, not all data sorting,What should I do? thank you!!!1

I use the link format is like this,

mygrid.loadXML("…/accountsServlet.do?uid="+(new Date()).valueOf());

protected void configure() {
Connection conn= null;
try {
String modelid=“archiveID”;
conn = ConnectionManager.getConnection();
GridConnector c=null;
c = new GridConnector(conn, DBType.MSSQL);
c.dynamic_loading(50);
c.event.attach(new ArchiveBehavior());
c.render_sql(sql,modelid,FieldName);
} catch (Exception e) {
System.out.println(sql);
e.printStackTrace();
}finally{
ConnectionManager.close(conn);
}
}

Unfortunately it is not possible, while grid really has all necessary info to sort data on the current page, default sorting functionality always attempt to sort whole recordset, which will not work for dynamic grids

I have a patch.

in function sortRows:

change

for (var i = 0; i < this.rowsBuffer.length; i++)

to:

			//只把当前页的内容拿去排序。
			var modify_start = (parseInt(this.currentPage)-1) * this.rowsBufferOutSize;
			var modify_end = modify_start + this.rowsBufferOutSize;
			if (modify_end > this.rowsBuffer.length)
					modify_end = this.rowsBuffer.length;
            for (var i =modify_start ; i < modify_end; i++)

then,

in function _sortRows :
change

this._sortCore(col, type, order, arrTS, this.rowsBuffer);

to:

		/**
		 * 这里用array_slice之类的函数把this.rowsBuffer切成三段:第一段|当前页|第三段
		 * 只把当前页拿去排序
		 * 排序完之后再把三段合并
		 */
		var modify_start = (parseInt(this.currentPage)-1) * this.rowsBufferOutSize;
		var modify_end = modify_start + this.rowsBufferOutSize;
		if (modify_end > this.rowsBuffer.length)
			modify_end = this.rowsBuffer.length;

		var array_1 = new Array();
		var array_2 = new Array();
		var array_3 = new Array();

		for(var i =0; i<modify_start; i++)
		{
				array_1[i-0] = this.rowsBuffer[i];
		}
		for(var i=modify_start;i<modify_end;i++)
		{
				array_2[i-modify_start] = this.rowsBuffer[i];
		}
		for(var i=modify_end; i< this.rowsBuffer.length; i++)
		{
				array_3[i-modify_end] = this.rowsBuffer[i];
		}


        //this._sortCore(col, type, order, arrTS, this.rowsBuffer);
        this._sortCore(col, type, order, arrTS, array_2);


		//合并
		for(var i =0; i<modify_start; i++)
		{
				this.rowsBuffer[i] = array_1[i-0] ;
		}
		for(var i=modify_start;i<modify_end;i++)
		{
				this.rowsBuffer[i] = array_2[i-modify_start] ; 
		}
		for(var i=modify_end; i< this.rowsBuffer.length; i++)
		{
				this.rowsBuffer[i] = array_3[i-modify_end] ;
		}	

and it works~~

glad to get response from u.