Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Use of IWBootstrap and IW templates
#1
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
Reply
#2
(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
Reply
#3
Hi Alexandre,

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


Forum Jump:


Users browsing this thread: 1 Guest(s)