B4J Question Web DataGrid

moster67

Expert
Licensed User
Longtime User
For my test website (built with B4JServer), I want to show and edit data in a DataGrid.
Ok, I can use normal HTML-tables but I would much prefer using some Web DataGrids which already includes options such as filtering, sorting, editing etc..

I guess something I can hook up perhaps exchanging data using json or whatever the best way to communicate with my underlying database (still need to decide what to use).

This is nothing fancy. I just need to it to migrate an old Access97 database to the web so it can be consulted.

Any ideas?
Thanks.
 

inakigarm

Well-Known Member
Licensed User
Longtime User
I'm using datatables plug-in for jquery (https://datatables.net) for display sqlite queries. In the B4J Jetty server handler, I build the hml page and the returned data with datatable.

Otherwise, you can use Banano library and for ex: https://www.b4x.com/android/forum/t...ting-grid-that-you-might-like.105225/#content or use datatable plugin with banano.
server.jpg

The Server is running a jRDC2 Server app and another b4J Jetty server on another Port for displaying results/queries (querying the jRDC2 Server)
 
Last edited:
Upvote 0

moster67

Expert
Licensed User
Longtime User
@inakigarm
Interesting and many thanks for your insight. I already had a look at the DataTables GridView which looks very nice although it is only in read-mode (the Editor version is payable). However, I will try it out and if it works well, I might just as well invest in it.
Also using banano seems like a viable solution. I will definitely have a look at it.
 
Upvote 0

moster67

Expert
Licensed User
Longtime User
I'm using datatables plug-in for jquery (https://datatables.net) for display sqlite queries. In the B4J Jetty server handler, I build the hml page and the returned data with datatable.
Are you using the legacy version or the latest version of DataTables?
If you are using the latest one, are you still using "sAjaxSource" (which is backward compatible to a certain degree) or are you using "ajax" and the new parameters?
 
Upvote 0

inakigarm

Well-Known Member
Licensed User
Longtime User
Are you using the legacy version or the latest version of DataTables?
If you are using the latest one, are you still using "sAjaxSource" (which is backward compatible to a certain degree) or are you using "ajax" and the new parameters?
I'm trying to answer how I implement this datatable.
I've an AWS Free Tier Server with two jserver instances, one a jRDC2 server and the second jserver that build the Webpages with the data.
The jRDC2 server works as a middleware server to a centralized DB, accessible from client devices (Windows) and the second jserver, the Web server for displaying results.
In the Web server, there're several handler, and one of these is the handler with the datatable plugin; this handler queries the jRDC2 server in the Tablesessions Handler (using a DBRequestManager module -modified- to build an html table).
The id of the html table is the same that the Datatable (sessions); this way, Datatable plugin displays the html table in the Database grid format automatically.
(Attached are the TableSessionsHandler, DBRequestManager module and the external file with the html page to light up this scenario)

TableSessionsHandler loads the datatable configuration from a external file (attached also), in order to modify the datatable representation on Web Page without modifying the jserver app.

DBRequestManager.bas
B4X:
'Prints the table 
Public Sub PrintonlyTableHTML(tipusquery As String,Table As DBResult) As String
    
    Dim sb As StringBuilder
    sb.Initialize
    
    sb.Append($"<table id="sessions" class="display" style="width:100%"><thead><tr>"$).Append(CRLF)

Hope I've explained clearly how this works on my server...
 

Attachments

  • DBRequestManager.bas
    5.5 KB · Views: 161
  • TableSessionsPage.txt
    5.4 KB · Views: 171
  • TableSessions.bas
    1.8 KB · Views: 153
Upvote 0
Top