Bootstrap tables and mod harbour

mod_harbour is an Apache module that allows to run PRGs directly on the web !!!
Post Reply
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Bootstrap tables and mod harbour

Post by Otto »

Hello friends,
I switched now from datatables to bootstrap table.
I think I will have more support here as TWeb uses this lib.
Best regards,
Otto

Image
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org

********************************************************************
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Re: Bootstrap tables and mod harbour

Post by Otto »

Hello friends,

I started working on bootstrap tables. I use a simple sample that reads data from a JSON file.

I am taking notes here. Maybe someone is interested too.

Sure it will take time before I can deal with bootstrap table in the same way as with xBrowse. :D

I am so free to ask questions here and hope that we beginners will get help from experienced friends.

Best regards,
Otto

Download - Link: https://mybergland.com/fwforum/ajaxtable_download.zip

Image
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org

********************************************************************
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Re: Bootstrap tables and mod harbour

Post by Otto »

Hello friends,
Now I read data from a DBF file.

Here is the pure Harbour code, which shows how to read from the DBF file into a HASH.
Then you convert the hash into a json .

Image

Here you see the js code, which creates the table and fills the data.

Image


This is the table

Image

Best regards,
Otto

Code: Select all

static cHash

function Main()
   local    hData := {=>}   
   local    hItem := {=>}   
   
   USE ( hb_GetEnv( "PRGPATH" ) + "/data/blog" ) new
   hData['data'] := {}
   
   do while .not. eof()
      
      hItem := {=>} 
      hItem['id']   := recno()
      hItem['header']   := ALLTRIM( field->HEADER )
      hItem['subheader']    := ALLTRIM( field->SUBHEADER )
      
      aadd( hData['data'], hItem )
      
      select blog
      skip
   enddo
   select blog
   use
   cHash := hb_jsonEncode( hData, .T. ) // T=pretty
   
   
   TEMPLATE PARAMS cHash 
   
   <!DOCTYPE html>
   <html lang="de">
   <head>
      <meta charset="utf-8"/>
      
      <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
      <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
      
      
      <link href="https://unpkg.com/bootstrap-table@1.18.1/dist/bootstrap-table.min.css" rel="stylesheet">
      
      <script src="https://unpkg.com/bootstrap-table@1.18.1/dist/bootstrap-table.min.js"></script>
      
      
      <style>
         table, th, td {
            border: 1px solid black;
            border-collapse: collapse;
         }
         .divbs {
            background-color: rgb(183, 212, 155);
            height: 350px;
            border: 1px solid black;
         }
      </style>
      
   </head>
   <body>
      <div class="divbs">
         <table id="table">
            <thead>
               <tr>
                  <th data-field="id">ID</th>
                  <th data-field="header">Header</th>
                  <th data-field="subheader">Subheader</th>
               </tr>
            </thead>
         </table>
      </div>      
      
      <script>
         
         var $table = $('#table')
         
         $(function() {
            var data = <?prg return ( cHash )?>;
            $table.bootstrapTable( data )
            
         })
      </script>
      
      ENDTEXT   

return nil

//----------------------------------------------------------------------------//


 
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org

********************************************************************
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Re: Bootstrap tables and mod harbour

Post by Otto »

Change HTML to mod Harbor

The project is now of a specific size, and it is no longer easy without a framework to edit. That's why I'm currently creating a project.

Video
https://mybergland.com/fwforum/crud.mp4

Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org

********************************************************************
Post Reply