Android Tutorial Grid Sample

Hey all,

This grid is like an open source project. It is completely written in a seperate B4A module and allows paging, 'custom' column types, horizontal and vertical scrolling, summation and basic filtering. It uses Nine Patch Images for the backgrounds of the headers, records and footers. The developer can provide the eventnames he/she wants to get triggered in the activity.

Not everything is tested but it is easy to change or adapt to your needs.

So, if your interested in this, just try the sample and be creative in here :).

Update: I've added a lot of comments to the source code and added the possibility the catch the header click event in the activity. Did some cleanup and fixed a spacing error.

Update2: Added basic ability for number formatting. To use it, you have to set the property 'NumberIntegersMin' higher than 0 by the column. 'NumberFractions' is for decimal places and 'NumberGrouping' is for grouping per 3.

Update 3: Added a DB Sample, changed some minor issues with column widths and backpanels in the DB Sample (grid code module).

Update 4: Custom Color Rules added by request on the B4A chat. With simple color rules you can now change the textcolor of the fields by a value1 and value2. You can use this for numbers or strings. See the 'ProAppGridSample' for an example.

Update 5: ProAppGridAdvSample. Added Row and Field selection (needs some activity code). Also added the possibility to change the value of a field without redrawing the whole grid. I have only implemented the Label function and it's taking autoheight into account.

Update 6: Added sorting (QuickSort) functionality and custom typefaces per column.

Update 7: Added MinHeightField to the TColumn definition. This way you can specify the height of a column by the value of another column. I updated the ProAppGridAdvSample with this and I've also added the sorting by clicking on the header in this sample.

-------------------------------------------------------------
Some screenshots of what is possible with this grid:
proappgridadvsample01.jpg
proappdbexplorer01.jpg


proappdbexplorer02.jpg


proappdbexplorer04.jpg


Greetings,
Sigurd
 

Attachments

  • ProAppGridDBSample.zip
    51.7 KB · Views: 1,651
  • ProAppGridSample.zip
    35.5 KB · Views: 1,407
  • ProAppGridAdvSample.zip
    37.9 KB · Views: 1,292
Last edited:

COBRASoft

Active Member
Licensed User
Longtime User
Hi,

Take the latest ProApp Grid Sample, starting from line 151 till 172 is shown how to select/deselect a row/field.
The main function is called on line 166: Grid.ToggleRowSelection(grdSample, objRow)

Greetings,
Sigurd
 

realblue

Member
Licensed User
Longtime User
Hi COBRASoft,

I tried to use your grid and works OK. But I have two problems. One is while the grid is being loaded at the footer row I see "java.lang.Object@.." instead of summary value. I debugged the code somehow objColumn.SummaryValue contains this value. But after the grid is loaded I see the correct values. Second is about summary value formatting. At the end of grid loading process I see objColumn.SummaryValue like "1278.01000005" but It doesn't get formatted because again (objColumn.SummaryValue Is Float OR objColumn.SummaryValue Is Double) condition doesn't return True.

Thanks in advance.
 

Rusty

Well-Known Member
Licensed User
Longtime User
Nice grid!
A couple of questions:
I have a grid of radio buttons (first column is text). Each row has several radio buttons within. When you touch a radio button in a row, they toggle perfectly. I need each row to be logically "connected" so that the radio button selections within each row toggle only the other radio buttons within THAT row. Right now, any radio button will toggle ALL radio buttons within the entire grid.
1. Is there a way to make the radio buttons toggle only those other radio buttons within the same row?

The background color(s) of the rows seems to be blue and green. I'm sure I've missed, but,
2. How do you change the background colors of the (alternating) rows?
Thanks!
Rusty

I found the color changes within the Grid class...but I'm still interested in the radio check box toggle issue.

NEW question: Is there a way to find out in which row the radio button that was clicked resides?
 
Last edited:
Top