Atozed Forums
Use of IWBootstrap and IW templates - Printable Version

+- Atozed Forums (https://www.atozed.com/forums)
+-- Forum: Atozed Software Products (https://www.atozed.com/forums/forum-1.html)
+--- Forum: IntraWeb (https://www.atozed.com/forums/forum-3.html)
+---- Forum: English (https://www.atozed.com/forums/forum-16.html)
+----- Forum: IntraWeb General Discussion (https://www.atozed.com/forums/forum-4.html)
+----- Thread: Use of IWBootstrap and IW templates (/thread-358.html)



Use of IWBootstrap and IW templates - jeroen.rottink - 06-06-2018

Hi,

The question I have is using IWBootstrap (TIWBSText) with templates. I'm using IW14 so it's not the new integrated IWBootstrap version from IW15.
I use bootstrap-table and the REST method for loading the table. It's all from templates.

Code:
<script type="text/javascript">
// connect dbGrid table to bootstrap-table object
$('#DBGRID').bootstrapTable(
 {"columns":[
   {"field":"product","title":"product"},
   {"field":"aantal","title":"aantal"},
   {"field":"afmeting","title":"afmeting"},
   {"field":"status","title":"status"}
 ],
 "url":"/$iwbs/DBGRID.dataurl",
 "classes":"table table-striped table-no-bordered"});
 
// connect table cell click event handler
$("#DBGRID").off("click-cell.bs.table").on("click-cell.bs.table", function(e, field, value, row) {
 ajaxCall("DBGRID.click-cell.bs.table","&row="+row.id, false);
});  
</script>

Here the data for the table is fetched from "/$iwbs/DBGRID.dataurl". In the form an eventhandler picks up the request and outputs a json response.
This works if you set TIWServerController.AllowMultipleSessionsPerUser = False. If you set this property to True, the url that is referenced doesn't trigger the eventhandler.
Because I would like a solution that works in both situations I changed the url to "../$iwbs/DBGRID.dataurl" in the template. This works in both situations.

Question: "Is this the correct and preferred way to work with these urls?"

Using IW14.1.3 and Delphi 10.1


RE: Use of IWBootstrap and IW templates - Alexandre Machado - 06-07-2018

(06-06-2018, 12:17 PM)jeroen.rottink Wrote: Hi,

The question I have is using IWBootstrap (TIWBSText) with templates. I'm using IW14 so it's not the new integrated IWBootstrap version from IW15.
I use bootstrap-table and the REST method for loading the table. It's all from templates.

Code:
<script type="text/javascript">
// connect dbGrid table to bootstrap-table object
$('#DBGRID').bootstrapTable(
 {"columns":[
   {"field":"product","title":"product"},
   {"field":"aantal","title":"aantal"},
   {"field":"afmeting","title":"afmeting"},
   {"field":"status","title":"status"}
 ],
 "url":"/$iwbs/DBGRID.dataurl",
 "classes":"table table-striped table-no-bordered"});
 
// connect table cell click event handler
$("#DBGRID").off("click-cell.bs.table").on("click-cell.bs.table", function(e, field, value, row) {
 ajaxCall("DBGRID.click-cell.bs.table","&row="+row.id, false);
});  
</script>

Here the data for the table is fetched from "/$iwbs/DBGRID.dataurl". In the form an eventhandler picks up the request and outputs a json response.
This works if you set TIWServerController.AllowMultipleSessionsPerUser = False. If you set this property to True, the url that is referenced doesn't trigger the eventhandler.
Because I would like a solution that works in both situations I changed the url to "../$iwbs/DBGRID.dataurl" in the template. This works in both situations.

Question: "Is this the correct and preferred way to work with these urls?"

Using IW14.1.3 and Delphi 10.1

Hi Jeroen,

I haven't tested this code yet, but I guess the original URL should work in both situations. Not sure why it is failing when AllowMultipleSessionsPerUser = True. Your fix might work, but relative URLs are not always good in IW because it might work in some applications and will definitely fail in others.
Do you have a simple test case using this construction that you could send me? If so, my e-mail is alexandre [at] atozed dot com. It will save me some time... :-)

Cheers


RE: Use of IWBootstrap and IW templates - jeroen.rottink - 06-07-2018

Hi Alexandre,

I'll send you an example this week, no problem.