SB Admin PHP – Fixed Table Header with Scrollable Body

Hi guys,

This question was raised to me recently and it peeked my interest to solve and find out how to do this. After digging around i found 2 working codes for my case.

To explain further my tables are generated dynamically so the column widths and gaps differ by each refresh of the table

There are the 2 options that i found

////////////// OPTION 1 //////////////////////
table tbody { display:block; max-height:450px; overflow-y:scroll; }
table thead, table tbody tr { display:table; width:100%; table-layout:fixed; }

table width=”100%” class=”table table-striped table-hover” id=”dataTables-example”
////////////// OPTION 2 //////////////////////
table {
overflow-y: auto;
height: 10vh;
}
thead th {
position: sticky;
top: 0;
}

table width=”100%” class=”table table-striped table-hover” id=”dataTables-example”

Hope this code helps out somebody out there. If you have any questions, just drop me a line.

Coffee Cup

Delphi 6 – Get Date From and Date To With Number of Days

So far I have recreated this code far more in the 16 years that I have been using Delphi. Just wanted to log it here so that when I need it again, it will be here.

Hope it can also help other people

Enjoy

Coffee Cup

procedure TfrmPassword.BitBtn1Click(Sender: TObject);
var
vWeekDay : String;
begin
//DateUtils
//get the first and last day
if (ALMONTH.VALUE <= 11) then
begin
ALFROM.VALUE := StrToDate( ALMONTH.Text + ‘/01/’ + ALYEAR.Text );
ALTO.VALUE := StrToDate( IntToStr(ALMONTH.VALUE + 1) + ‘/01/’ + ALYEAR.Text ) – 1;
end
else
begin
ALFROM.VALUE := StrToDate( ’12/01/’ + ALYEAR.Text );
ALTO.VALUE := StrToDate( ’01/01/’ + inttostr(ALYEAR.Value + 1) ) – 1;
end;
//loop the number of days
ALDAYS.VALUE := DaysBetween(ALTO.VALUE, ALFROM.VALUE) + 1;
ALDATE.VALUE := ALFROM.VALUE;
ALSUN.VALUE := 0;
ALTOTAL.Value := 0;
while (ALDATE.Value <= ALTO.Value) do
begin
vWeekDay := LongDayNames[DayOfWeek(ALDATE.Value)]; if (vWeekDay = 'Sunday') then ALSUN.VALUE := ALSUN.VALUE + 1 else ALTOTAL.Value := ALTOTAL.Value + 1; ALDATE.Value := ALDATE.Value + 1;
end;
end;