Bootstrap table width

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
sangnandar
User
Posts: 980

Bootstrap table width

Post by sangnandar »

Help me on this.

List-Page.
Page_DataRendering()
$header = <div id="head" style="text-align:center;">(I put MyButton at the center of this div)</div>

The <div> will be 100% of screen width.
I need MyButton to be at the center of the table (which in this case is not 100% of screen width) so I put this code on Startup Script:

var a = $("div[class='box ewBox ewGrid (mytablename)']").width(); // take the value of bootstrap table width.
$("#head").width(a); // set MyButton's div width.

It works ok, MyButton is now at the center of the table.

But....
Since Startup Script was put at the very end of the ...list.php, MyButton will first draw at the center of the screen then MOVED to the center of table. This movement kinda ugly though.

Any idea how to avoid this movement?
Is there any way to take the value of bootstrap table width within server event?

Thanks.


mobhar
User
Posts: 11702

Post by mobhar »

Try to move your code from "Startup Script" to "Client Script" section. Does it help?


sangnandar
User
Posts: 980

Post by sangnandar »

Try to move the script to Client Script doesn't work.

In my ...list.php the bootstrap table draw at line 2174
<div class="box ewBox ewGrid<?php if ($(tablename)_list->IsAddOrEdit()) { ?> ewGridAddEdit<?php } ?> (tablename)"> // line 2174

While client script is at line 2120
var a = $("div[class='box ewBox ewGrid (tablename)']").width(); // line 2120

$header is ok, at line 1948.


sangnandar
User
Posts: 980

Post by sangnandar »

In my understanding, any client script that take property value of an element should run after the element has been drawn, i.e after line 2174. Am I correct?
Page_DataRendering(&$header) is around line 1948.


Post Reply