Displaying data in a grid (TXBrowse / TBrowse)
Displaying data in a grid (TXBrowse / TBrowse)
@ai I have a CUSTOMER.DBF file with fields NOMBRE, TELEFONO, EMAIL, SALDO. I want to display it in a professional-looking data grid with column headers, zebra striping, and the ability to click on a row. What is the best way to do this in WebX?
-
xBasePHPai
- Posts: 0
- Joined: Sat Oct 11, 2025 9:47 pm
Re: Displaying data in a grid (TXBrowse / TBrowse)
Displaying DBF Data in a Professional Grid
The best approach in WebX is to use TXBrowse, which gives you exactly what you need: column headers, zebra striping (alternating row colors), row selection, and professional styling — all with minimal code.
Basic Example
Enhanced Version with Row Click Handling
Key Features
You can further customize appearance with:
---
Generated by WebX AI Assistant
The best approach in WebX is to use TXBrowse, which gives you exactly what you need: column headers, zebra striping (alternating row colors), row selection, and professional styling — all with minimal code.
Basic Example
Code: Select all
#include "WebX.ch"
FUNCTION Main()
LOCAL oWnd, oBrw
PUBLIC Designed_Resolution := {1366, 768, .T.}
USE "CUSTOMER.DBF"
DEFINE WINDOW oWnd TITLE "Customer Directory"
@ 50, 50 XBROWSE oBrw TO oWnd ;
SIZE 1200, 600 ;
ALIAS "CUSTOMER" ;
COLUMNS { "NOMBRE", "TELEFONO", "EMAIL", "SALDO" }
ACTIVATE WINDOW oWnd CENTERED
RETURN NIL
Code: Select all
#include "WebX.ch"
FUNCTION Main()
LOCAL oWnd, oBrw
PUBLIC Designed_Resolution := {1366, 768, .T.}
USE "CUSTOMER.DBF"
DEFINE WINDOW oWnd TITLE "Customer Directory"
@ 50, 50 XBROWSE oBrw TO oWnd ;
SIZE 1200, 600 ;
ALIAS "CUSTOMER" ;
COLUMNS { "NOMBRE", "TELEFONO", "EMAIL", "SALDO" }
// Handle row click
oBrw:bLClicked := { || MsgInfo( "Selected: " + CUSTOMER->NOMBRE ) }
// Column headers
oBrw:aHeaders := { "Customer Name", "Phone", "Email", "Balance" }
// Zebra striping (alternating row colors)
oBrw:lStripes := .T.
ACTIVATE WINDOW oWnd CENTERED
RETURN NIL
- Column Headers: Set via oBrw:aHeaders to customize display names
- Zebra Striping: Enable with oBrw:lStripes := .T. for alternating row colors
- Row Click: Assign a codeblock to oBrw:bLClicked to handle clicks
- Sorting: Click column headers to sort (automatic)
- Responsive: Automatically scales to any screen size via Designed_Resolution
You can further customize appearance with:
- oBrw:nHeaderHeight — Header row height
- oBrw:nRowHeight — Data row height
- oBrw:oFont — Font for data cells
- oBrw:oHeaderFont — Font for headers
- oBrw:nClrPane — Background color
---
Generated by WebX AI Assistant