This is my problem : I want to disable tdbgrid auto-sort after inserting a new record. I want tdbgrid perform sort ONLY IF the user ask them (clicking the column title).
I have a table named f4400 and has two columns, sec_code and sec_desc(both are varchar).
Let say that may table contains these records:
sec_code sec_desc
1 , section 1 xxxxxxxxxxxxxxxxx
2 , section 2 xxxxxxxxxxxxxxxxx
3 , section 3 xxxxxxxxxxxxxxxxx
when I query f4400 and put it in the tdbgrid, both looked the same. When I insert a new record, let say ("11", "section 11"), my grid would now look like these :
sec_code sec_desc
1 , section 1 xxxxxxxxxxxxxxxx
2 , section 2 xxxxxxxxxxxxxxxx
3 , section 3 xxxxxxxxxxxxxxxx
11 , section 11 xxxxxxxxxxxxxxxx
so far so good. now, I will sort my grid by sec_code desc. My tdbgrid will now look like this:
3 , section 3 xxxxxxxxxxxxxxxx
2 , section 2 xxxxxxxxxxxxxxxx
1 , section 1 xxxxxxxxxxxxxxxx
11 , section 11 xxxxxxxxxxxxxxxx
now, I will insert a new record let say ("21", "section 21"), tdbgrid will gave me a result of :
sec_code sec_desc
3 , section 3 xxxxxxxxxxxxxxxx
2 , section 2 xxxxxxxxxxxxxxxx
21 , section 21 xxxxxxxxxxxxxxxx
1 , section 1 xxxxxxxxxxxxxxxx
11 , section 11 xxxxxxxxxxxxxxxx
The result I wanted is :
sec_code sec_desc
3 , section 3 xxxxxxxxxxxxxxxx
2 , section 2 xxxxxxxxxxxxxxxx
1 , section 1 xxxxxxxxxxxxxxxx
11 , section 11 xxxxxxxxxxxxxxxx
21 , section 21 xxxxxxxxxxxxxxxx
The row position of "sec_code 21" is my problem. I inserted it at the bottom of the tdbgrid so i want to see "sec_code 21" at the bottom of the grid.
I tried using tdbgrid.datasource.dataset.sort := '' but it will give a an output like this:
sec_code sec_desc
1 , section 1 xxxxxxxxxxxxxxxx
11 , section 11 xxxxxxxxxxxxxxxx
2 , section 2 xxxxxxxxxxxxxxxx
21 , section 21 xxxxxxxxxxxxxxxx
3 , section 3 xxxxxxxxxxxxxxxx
I tried using tdbgrid.datasource.dataset.IndexFielName := '' but it will give a an output like this:
sec_code sec_desc
1 , section 1 xxxxxxxxxxxxxxxx
2 , section 2 xxxxxxxxxxxxxxxx
3 , section 3 xxxxxxxxxxxxxxxx
11 , section 11 xxxxxxxxxxxxxxxx
21 , section 21 xxxxxxxxxxxxxxxx
The position of "sec_code 21" is not my problem anymore, but, the positions of "sec_code 1,2,3 and 11" are not in there positions i wanted. i sorted sec_code 1,2,3 and 11 descending so i want to see sec_code 1,2,3 and 11(not including sec_code 21) to be sorted descending.
hope you understand my problem and would try to suggest how can i give solution to that. It's been headache to me for about 3-4 nights.
Thanks in advance