Web Connection
HtmlDataGrid with Textboxes
Gravatar is a globally recognized avatar based on your email address. HtmlDataGrid with Textboxes
  Markus Winhard
  All
  Jun 14, 2017 @ 05:54am

Hi Rick,

Web Connection has a HtmlDataGrid() function. As far as I understand it renders a VFP cursor as HTML.

We like to use HtmlDataGrid() in our VFP desktop application. But we want some columns as Textboxes and edit/update the VFP cursor this way. Is this possible?

Is there a short example that shows how to do this?

TIA, Markus

Gravatar is a globally recognized avatar based on your email address. re: HtmlDataGrid with Textboxes
  Rick Strahl
  Markus Winhard
  Jun 14, 2017 @ 11:05am

Yeah it's possible but you have to basically inject the HTML for the text boxes via expression functions that are called from HtmlDataGrid(). You can use HtmlTextBox() or manually create a function that is called from one of the binding expressions.

Note all the styling of the grid requires related CSS resources to be distributed with your app (bootstrap and customized css).

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: HtmlDataGrid with Textboxes
  Alex
  Rick Strahl
  Jun 20, 2017 @ 07:58am

Hi Rick, I read also from your HtmlDataGrid() function. This sounds very interesting for me and I think a lot of VFP programmers as well... We would replace a lot of ActiveX components and VFP grids, if we can use your HtmlDataGrid() function in connection with HtmlTextBox() etc. I'm sure you have a lot of work to do, but, do you have or can you create a full (but short) example how to do this? For me it's hours and hours (or days) for testing, for you maybe only a view minutes...

The example should do:

  • Executing a SQL Command (Select * from adress into cursor xy)
  • Show the fields NAME, NAME2, ZIP, COUNTRY in a list (via HtmlDataGrid())
  • The fields NAME, NAME2 should be editable and updated to the VFP-Cursor xy (using HtmlTextBox())
  • The field NAME should be sortable
  • All above has to work in a VFP9 desktop application
  • How can I run VFP code when the user clicks a link/row/field in your grid

This would help a lot and if it's working, I will buy immediately ??

Thanx in advance

Gravatar is a globally recognized avatar based on your email address. re: HtmlDataGrid with Textboxes
  Rick Strahl
  Alex
  Jun 20, 2017 @ 04:26pm

That's an incredibly bad idea ??

Using data grids for editing in general is a UI anti-pattern. Heck using editable grids is a massive anti-pattern. If you really want that sort of thing to work I recommend to look into JavaScript components DataGrid components or some JS based spreadsheet component.

Doing manual textbox layout is possible but it's almost guaranteed to behave badly for all but the simplest use cases. Building a workable grid is difficult. Building one that behaves as you would expect a real grid/browser to behave requires years of refinement and tweaking.

+++ Rick ---

© 1996-2017