B4J Question Web DataGrid

Discussion in 'B4J Questions' started by moster67, Jun 7, 2019.

  1. moster67

    moster67 Expert Licensed 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.
     
  2. inakigarm

    inakigarm Well-Known Member Licensed 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: Jun 7, 2019
  3. moster67

    moster67 Expert Licensed 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.
     
  4. moster67

    moster67 Expert Licensed 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?
     
  5. inakigarm

    inakigarm Well-Known Member Licensed User

    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
    Code:
    '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...
     

    Attached Files:

    José J. Aguilar and moster67 like this.
  6. moster67

    moster67 Expert Licensed User

    Thank you very much @inakigarm
    I'm going to have a look at it this weekend.
     
  7. inakigarm

    inakigarm Well-Known Member Licensed User

Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice