473,238 Members | 1,622 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,238 software developers and data experts.

DataGrid column sorting

Boa constructor
Windows XP
python 2.3

How do you sort data alphabetically in the grid column.

In one of the previous post i found a link
its not in python so can anyone please explain the logic behind it.

it was (fairly)easy to sort the datagrid column if the column contained just numbers.
( double click event on a particular column label)
Expand|Select|Wrap|Line Numbers
  2.             counter = 1
  3.             Number_of_rows_Grid1 = self.grid1.GetNumberRows()
  4.             self.grid1.InsertRows(pos=Number_of_rows_Grid1, numRows=1)
  5.             for rows1 in range (0, Number_of_rows_Grid1-1):    
  6.                 P1 = self.grid1.GetCellValue(rows1, clicked_column_number)
  7.                 if (P1):
  8.                     P1 = float(P1)
  9.                 else:
  10.                     P1 = 0.00
  11.                 for rows2 in range (counter, Number_of_rows_Grid1-1):
  12.                     P2 = self.grid1.GetCellValue(rows2, clicked_column_number)
  13.                     if (P2):
  14.                         P2 = float(P2)
  15.                     else:
  16.                         P2 = 0.00
  18.                     if (P2<P1):
  19.                         for col in range (0, 10):
  20.                             self.grid1.SetCellValue(Number_of_rows_Grid1, col, self.grid1.GetCellValue(rows1, col))
  21.                             self.grid1.SetCellValue(rows1, col, self.grid1.GetCellValue(rows2, col))
  22.                             self.grid1.SetCellValue(rows2, col, self.grid1.GetCellValue(Number_of_rows_Grid1, col))
  23.                         P1 = P2
  24.                 counter = counter + 1
  25.             self.grid1.DeleteRows(pos=Number_of_rows_Grid1, numRows=1)
Nov 29 '07 #1
0 1217

Sign in to post your reply or Sign up for a free account.

Similar topics

by: Sargas Atum | last post by:
Hi all, 1. I have a problem with cell selection in a table in a DataGrid. I dont want that anybody writes in the cells. That was not a problem I changed them to "read only", but if I am going...
by: melanieab | last post by:
Hi, I'm programatically sorting in a datagrid. When a column header is clicked, the sort happens twice for some reason, making it looks like it only sorts in descending order. I can tell it...
by: John Richardson | last post by:
I've been bothered for some time about my DataGrid not populating my rows very quickly. I have about 10K rows loading into the grid. I create a datatable dt with 2 columns, an ID and a display. ...
by: Robert Brinson | last post by:
Hello all! I'm running .NET Framework 1.1 using VS.NET 2003. I've got a mystery with a DataGrid. Below is the definition of the DataGrid from my aspx page: </asp:datagrid><asp:datagrid...
by: rkbnair | last post by:
I have created a datagrid in my aspx with the 'AllowSorting' property to true. When clicking on the column header, the page refreshes. However the sorting is not done. Am I missing anything? I...
by: Lars Netzel | last post by:
I have a Datagrid using the Edit/Update mode to alter data in the datasource. I needed to have a bit more flexible interface in the editmode with a design that couldn't work in the columns. So I...
by: skOOb33 | last post by:
I successfully autosized the columns and rows on my Datagrid, and am now facing another issue. Having the sorting ability by clicking the column headers is key, but when I do that, it resizes all...
by: TPhelps | last post by:
I have a sample of an unbound (autogeneratecolumns is true) sortable/pagable datagrid that works. I want to change one of the columns to a hyperlink. The examples I find use a bound column. I...
by: Ambica Jain | last post by:
Hi, I want custom sorting on some of the columns in the datagrid. And i am able to do the same by overriding MouseDown event. However, i need to rebind my datatable to reflect the changes in...
by: ECD | last post by:
Hello all, I can usually find solutions to my .NET problems by searching these groups, but I'm stumped on this one. I have a datagrid in VB.NET (2.0 framework). I want to disable sorting on...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.