Sorting using column name instead of column index

I want to sort a datastore synced with a grid by column.

I can’t use the column index inside the dhx_sort parameter, since my connector doesn’t know what the column index refers too. What I’d like to use is the column name, which corresponds to a field in my db table.

So to sum things up, I’d like to convert the call to the connector from:

http://mysite.com/connector.php?connector=true&dhx_sort[0]=asc

to

http://mysite.com/connector.php?connector=true&dhx_sort[myfieldname]=asc

Is it possible, is there an alternative solution?

Thanks!

You may get the label of the column knowing it’s index:

var colLabel=mygrid.getColLabel(ind);