NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: urayoan on August 27, 2020, 04:47:36 AM

Title: Browse View Without a Table
Post by: urayoan on August 27, 2020, 04:47:36 AM
Hi all. It is possible to create a Browse View without a table ans select a record from that table?

If yes, some ideas would be helpful.

Thanks @UrayoƔn
Title: Re: Browse View Without a Table
Post by: bshields on August 27, 2020, 06:56:01 PM
Hi,

I use the IMDD if I need to work on some data that doesn't have a table in the database schema.

I've also hand coded my own browse in html, but if you want some or all of NTs (generous) Browse functionality, i'd suggest IMDD, its handy. I even some some generic IMDD structures for general purpose stuff.

Regards
Bill
Title: Re: Browse View Without a Table
Post by: Bruce on August 27, 2020, 11:26:05 PM
>> Is it possible to create a Browse View without a table ans select a record from that table?

no
Use a table. InMemory table would be fine.

Of course DROP controls allow you to select from non-table-items. But you can't browse a non-table.
Title: Re: Browse View Without a Table
Post by: urayoan on August 28, 2020, 04:17:07 AM
Thank you Bill and Bruce,

The problem i have is, i have the dictionary, but i am not authorized to make changes on it.

Another way i was thinking is, make the table declaration in the Global Embeds, but i don't know if the NetTalk template does like that.

What do you think about that Bruce?
Title: Re: Browse View Without a Table
Post by: bshields on August 29, 2020, 03:06:35 AM
Ok, you made this weird by not being able to change the dictionary.

Try https://datatables.net/ Its actually pretty easy and you supply the table contents via json.

I've included a pic of me using it (table at bottom of the page)
Title: Re: Browse View Without a Table
Post by: Bruce on August 30, 2020, 10:58:10 PM
>> The problem i have is, i have the dictionary, but i am not authorized to make changes on it.

A hand-coded table won't work, because the templates work on the dictionary.

Your alternative then is either hand-coding a table of some kind, or waiting for NetTalk 12 (which has "Json List support")

Cheers
Bruce
Title: Re: Browse View Without a Table
Post by: bshields on August 31, 2020, 03:45:08 AM
Quote
Your alternative then is either hand-coding a table of some kind, or waiting for NetTalk 12 (which has "Json List support")

:)
Title: Re: Browse View Without a Table
Post by: urayoan on August 31, 2020, 04:37:29 AM
Ok, you made this weird by not being able to change the dictionary.

Thank you Bill, i was taking a similar approach, but creating the js on my side. Definitely the tool you show me here it gonna help me a lot with this!

Title: Re: Browse View Without a Table
Post by: urayoan on August 31, 2020, 04:39:30 AM
>> The problem i have is, i have the dictionary, but i am not authorized to make changes on it.

A hand-coded table won't work, because the templates work on the dictionary.

Your alternative then is either hand-coding a table of some kind, or waiting for NetTalk 12 (which has "Json List support")

Cheers
Bruce

Thanks Bruce, cant wait to see that tease you give us with NetTalk, sadly, cant wait for that because the project is rush, but very exited to see that is gonna be possible to do in near NetTalk releases!
Title: Re: Browse View Without a Table
Post by: bshields on August 31, 2020, 04:56:56 AM
Hope they help. They suit me when i'm doing light weight pretty stuff. You do get pagination, sorting on columns and some other stuff.
Title: Re: Browse View Without a Table
Post by: Alberto on August 31, 2020, 05:03:50 AM
Why dont use an existing dct file changing its porp:name?
You can choose a file similar to what you need, change its prop:name and fill that named file with the records you need.
Just a thought.
Title: Re: Browse View Without a Table
Post by: bshields on August 31, 2020, 05:08:18 AM
This might fast track you (or not!) but maybe it will help.


<section id="configuration">
  <div class="row">
    <div class="col-12">
      <div class="card">
        <div class="card-header">
          <h4 class="card-title">Listing & Sales Performance</h4>
        </div>
        <div class="card-content">
          <div class="table-responsive">
            <table class="table table-striped staff-table">
              <thead>
                <tr>
                  <th>Name</th>
                  <th class="dt-right">Listings</th>
                  <th class="dt-right">Sales</th>
                  <th class="dt-right">%</th>
                  <th class="dt-right">Days on Market</th>
                  <th class="dt-right">Withdrawn</th>
                  <th class="dt-right">%</th>
                </tr>
              </thead>
            </table>
          </div>
        </div>
      </div>
    </div>
  </div>
</section>


Thats my HTML

<script src="/app-assets/vendors/js/tables/datatable/datatables.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
  $('.staff-table').DataTable( {
    "order": [[ 1, "desc" ]],
    "info":     false,
    "bLengthChange": false,
    "bFilter": false,
    "iDisplayLength": 6,
    "columnDefs": [{
        targets: -1,
        className: 'dt-right'
    }],
   "columns": [null,{"width": "100px"},{"width": "100px"},{"width": "80px"},{"width": "100px"},{"width": "100px"},{"width": "80px"}],
    "ajax": '/GenTable?c=listing'
  });
});


Thats the Scripts on the bottom of the same page.

/GenTable?c=listing

That my NetTalk function that generates the JSON.

st.SetValue('')
Access:MyFile.Open()
MyFile{PROP:SQL} = 'MyQuery'
LOOP
  NEXT(MyFile)
  IF ERRORCODE() ~= 0 THEN BREAK.
  st.Append('["'&CLIP(Field1)&'","'&CLIP(Field2)&'","'&CLIP(Field3)&'","'&LEFT(FORMAT(Field4,@n$20))&'","'&LEFT(FORMAT(Field5,@n3))&'%"]',1,',')
.
st.Prepend('{{ "data":[')
st.Append(']}')


Thats a snippet of my NetWebPage that creates the JSON.
Title: Re: Browse View Without a Table
Post by: urayoan on August 31, 2020, 07:07:07 AM
Why dont use an existing dct file changing its porp:name?
You can choose a file similar to what you need, change its prop:name and fill that named file with the records you need.
Just a thought.

Didn't think of that Alberto, but will try and see if it is doable in my case! Thanks for the hint
Title: Re: Browse View Without a Table
Post by: urayoan on August 31, 2020, 07:07:47 AM
This might fast track you (or not!) but maybe it will help.

Oh yes Bill, that does help a lot. Thanks!
Title: Re: Browse View Without a Table
Post by: urayoan on August 31, 2020, 07:15:31 AM
I've included a pic of me using it (table at bottom of the page)

BTW i forgot to mention, very well done job you have made with your page!