Why is the content in a modal dialog being truncated? - oracle-apex-5

I'm following along a book tutorial and I've hit a problem that I can't solve. Hopefully somebody here can help.
There is essentially a modal dialog - wizard dialog - with dynamic pl/sql content, which is being truncated for some reason. I'm wondering if this is normal behaviour:
The db is sending more than those 3 rows displayed in the Product/Price table. If I hack the code to stop rendering rows after one row:
Is this something that's easily explainable? The code that's building all this stuff is this; I don't expect anyone to read it in detail, but I'm just left wondering if a browser is supposed to automatically insert a vertical scrollbar:
[original lengthy code removed]
Thanks
Edit:
I've removed inline CSS on the page, and reduced the dynamic PL/SQL to this, but it's still happening:
declare
l_customer_id varchar2(30) := :P11_CUSTOMER_ID;
begin
-- display products
sys.htp.p('<div class="Products" >');
sys.htp.p('<table width="100%" cellspacing="0" cellpadding="0" border="0">
<thead>
<tr><th class="left">Product</th><th>Price</th><th></th></tr>
</thead>
<tbody>');
for c1 in (select product_id, product_name, list_price, 'Add to Cart' add_to_order from demo_product_info where product_avail = 'Y' union all
select product_id, product_name, list_price, 'Add to Cart' add_to_order from demo_product_info where product_avail = 'Y'order by product_name) loop
sys.htp.p('<tr><td class="left">'||sys.htf.escape_sc(c1.product_name)||'</td>
<td>'||trim(to_char(c1.list_price,'999G999G990D00')) || '</td>
<td><a ><span>Add<i class="iR"></i></span></a></td>
</tr>');
end loop;
sys.htp.p('</tbody></table>');
sys.htp.p('</div>');
sys.htp.p('<b>DONE</b>');
end;
There are 11 rows returned by the sql query; I've doubled them up to 22 so there should be 22 rows in the resulting table, but this is the output:
I don't know if it helps, but...

Have you set a height for your modal page in page settings?
Try to put this css in your page settings:
*Change this number (400) by the height of your modal or something close to that.
.CustomerInfo {
height: 400px;
overflow: auto !important;
}
I don't know why this happen, I think this issue is related of this property https://www.w3schools.com/cssref/pr_pos_overflow.asp
EDIT
I created this page to test: page 25 is the modal page, page 23 have a link to the modal page.
https://apex.oracle.com/pls/apex/f?p=145797:23
Login on: https://apex.oracle.com/pls/apex/f?p=4550:1
workspace: stackquestions
user: test
pwd: test
app: 145797
wizard modal page: 25
Could check if is there any diference in the page settings or in the region settings between your modal page and this page above? or could you try to replicate this problem in this workspace?
The wizard modal page have a region with this pl/sql, the same of yours, but with fake data.
declare
v_count NUMBER := 0;
v_max_count NUMBER := 30;
begin
-- display products
sys.htp.p('<div class="Products" >');
sys.htp.p('<table width="100%" cellspacing="0" cellpadding="0" border="0">
<thead>
<tr><th class="left">Product</th><th>Price</th><th></th></tr>
</thead>
<tbody>');
loop
sys.htp.p('<tr><td class="left">'||'product - ' || v_count ||'</td>
<td>'|| '50 - ' || v_count || '</td>
<td><a ><span>Add<i class="iR"></i></span></a></td>
</tr>');
v_count := v_count + 1;
EXIT WHEN v_count >= v_max_count;
end loop;
sys.htp.p('</tbody></table>');
sys.htp.p('</div>');
sys.htp.p('<b>DONE</b>');
end;

Related

how to apply filter on JQuery DataTable each columns? [duplicate]

I'm trying to filter table rows in an intelligent way (as opposed to just tons of code that get the job done eventually) but a rather dry of inspiration.
I have 5 columns in my table. At the top of each there is either a dropdown or a textbox with which the user may filter the table data (basically hide the rows that don't apply)
There are plenty of table filtering plugins for jQuery but none that work quite like this, and thats the complicated part :|
Here is a basic filter example http://jsfiddle.net/urf6P/3/
It uses the jquery selector :contains('some text') and :not(:contains('some text')) to decide if each row should be shown or hidden. This might get you going in a direction.
EDITED to include the HTML and javascript from the jsfiddle:
$(function() {
$('#filter1').change(function() {
$("#table td.col1:contains('" + $(this).val() + "')").parent().show();
$("#table td.col1:not(:contains('" + $(this).val() + "'))").parent().hide();
});
});
Slightly enhancing the accepted solution posted by Jeff Treuting, filtering capability can be extended to make it case insensitive. I take no credit for the original solution or even the enhancement. The idea of enhancement was lifted from a solution posted on a different SO post offered by Highway of Life.
Here it goes:
// Define a custom selector icontains instead of overriding the existing expression contains
// A global js asset file will be a good place to put this code
$.expr[':'].icontains = function(a, i, m) {
return $(a).text().toUpperCase()
.indexOf(m[3].toUpperCase()) >= 0;
};
// Now perform the filtering as suggested by #jeff
$(function() {
$('#filter1').on('keyup', function() { // changed 'change' event to 'keyup'. Add a delay if you prefer
$("#table td.col1:icontains('" + $(this).val() + "')").parent().show(); // Use our new selector icontains
$("#table td.col1:not(:icontains('" + $(this).val() + "'))").parent().hide(); // Use our new selector icontains
});
});
This may not be the best way to do it, and I'm not sure about the performance, but an option would be to tag each column (in each row) with an id starting with a column identifier and then a unique number like a record identifier.
For example, if you had a column Produce Name, and the record ID was 763, I would do something like the following:
​​<table id="table1">
<thead>
<tr>
<th>Artist</th>
<th>Album</th>
<th>Genre</th>
<th>Price</th>
</tr>
</thead>
<tbody>
<tr>
<td id="artist-127">Red Hot Chili Peppers</td>
<td id="album-195">Californication</td>
<td id="genre-1">Rock</td>
<td id="price-195">$8.99</td>
</tr>
<tr>
<td id="artist-59">Santana</td>
<td id="album-198">Santana Live</td>
<td id="genre-1">Rock</td>
<td id="price-198">$8.99</td>
</tr>
<tr>
<td id="artist-120">Pink Floyd</td>
<td id="album-183">Dark Side Of The Moon</td>
<td id="genre-1">Rock</td>
<td id="price-183">$8.99</td>
</tr>
</tbody>
</table>
You could then use jQuery to filter based on the start of the id.
For example, if you wanted to filter by the Artist column:
var regex = /Hot/;
$('#table1').find('tbody').find('[id^=artist]').each(function() {
if (!regex.test(this.innerHTML)) {
this.parentNode.style.backgroundColor = '#ff0000';
}
});
You can filter specific column by just adding children[column number] to JQuery filter. Normally, JQuery looks for the keyword from all the columns in every row. If we wanted to filter only ColumnB on below table, we need to add childern[1] to filter as in the script below. IndexOf value -1 means search couldn't match. Anything above -1 will make the whole row visible.
ColumnA | ColumnB | ColumnC
John Doe 1968
Jane Doe 1975
Mike Nike 1990
$("#myInput").on("change", function () {
var value = $(this).val().toLowerCase();
$("#myTable tbody tr").filter(function () {
$(this).toggle($(this.children[1]).text().toLowerCase().indexOf(value) > -1)
});
});
step:1 write the following in .html file
<input type="text" id="myInput" onkeyup="myFunction()" placeholder="Search for names..">
<table id="myTable">
<tr class="header">
<th style="width:60%;">Name</th>
<th style="width:40%;">Country</th>
</tr>
<tr>
<td>Alfreds Futterkiste</td>
<td>Germany</td>
</tr>
<tr>
<td>Berglunds snabbkop</td>
<td>Sweden</td>
</tr>
<tr>
<td>Island Trading</td>
<td>UK</td>
</tr>
<tr>
<td>Koniglich Essen</td>
<td>Germany</td>
</tr>
</table>
step:2 write the following in .js file
function myFunction() {
// Declare variables
var input, filter, table, tr, td, i;
input = document.getElementById("myInput");
filter = input.value.toUpperCase();
table = document.getElementById("myTable");
tr = table.getElementsByTagName("tr");
// Loop through all table rows, and hide those who don't match the search query
for (i = 0; i < tr.length; i++) {
td = tr[i].getElementsByTagName("td")[0];
if (td) {
if (td.innerHTML.toUpperCase().indexOf(filter) > -1) {
tr[i].style.display = "";
} else {
tr[i].style.display = "none";
}
}
}
}

yadcf remove select option before exFilterColumn()

I am trying to remove a select option from an external filter select field using yadcf 0.8.9. In yadcf 0.6.9 I was able to remove this option before the call to exFilterColumn(), but in 0.8.9 I must remove the option after the call.
Actually what I am trying to do is force the select to have some value which is in the table column, and to have the table filtered on that value
I can't seem to figure out how to remove the unfiltered possibility from the select and have the table filtered on the chosen value (either the first or one I am picking in the code). In 0.6.9, I removed '-1' value option, but this doesn't seem to work in 0.8.9.
Advice?
See http://codepen.io/louking/pen/ZWYpGM vs http://codepen.io/louking/pen/zqxBLL
html:
<div>
<span id='yadcfext'></span>
</div>
<table id=tbl>
<thead>
<tr>
<th>col0</th>
<th>col1</th>
<th>col2</th>
</tr>
</thead>
<tbody>
<tr>
<td>a0</td>
<td>b0</td>
<td>c0</td>
</tr>
<tr>
<td>a1</td>
<td>b1</td>
<td>c1</td>
</tr>
</tbody>
</table>
remove option before exFilterColumn
var dt= $('#tbl')
.dataTable()
.yadcf([
{column_number: 0,
filter_container_id: 'yadcfext'}
]);
var selectfilter = '#yadcfext';
$(selectfilter + ' option[value="-1"]').remove();
yadcf.exFilterColumn(dt, [[0,'a1']]);
remove option after exFilterColumn()
var dt= $('#tbl')
.dataTable()
.yadcf([
{column_number: 0,
filter_container_id: 'yadcfext'}
]);
yadcf.exFilterColumn(dt, [[0,'a1']]);
var selectfilter = '#yadcfext';
$(selectfilter + ' option[value="-1"]').remove();
Sounds like a new feature :)
So since 0.9.0.beta.9 you can use the ommit_default_label option, see your codepen in action
* omit_default_label
Required: false
Type: boolean
Default value: false
Description: Prevent yadcf from adding "default_label" (Select value / Select values)
Note Currently supported in select / multi_select / custom_func / multi_select_custom_func

AutoIncrement SerialNo not working correctly when using PagedList.Mvc

I am using PagedList.Mvc in my project and its working absolutely fine.But the problem is after installing it serialno is not autoincremented.
For example if i've 20 records in the db and showing only 10 records in the page listed from 1 to 10,on selecting second page instead of showing serialno from 11 to 20,its still showing serialno as 1 to 10 .
The code is given below
<tbody>
#foreach (var item in Model.Select((x, i) => new { Data = x, Index = i }))
{
<tr>
<td>#(item.Index+1)</td> `SerialNo is displayed here`
<td>#Html.DisplayFor(modelItem=>item.Data.SITENAME)</td>
<td>#Html.DisplayFor(modelItem=>item.Data.REMARKS)</td>
</tr>
</tbody>
How can i retain the value of last record and increment onselecting the second page ??
Assuming that your model here is PagedList<T>, then you would need to calculate the current number using:
#(item.Index + ((Model.PageNumber - 1) * Model.PageSize) + 1)

Auto navigate (scroll) to certain table row

I have a table with few thousand records on few pages in a simple html table.. I made a search function that works fine apart from one thing... It displays only one result in a table (which is great cause it means it works!).But... I was wondering is there a way to display back the table with all records, with the one that i was searching for in the middle and highlighted? Here's a simplified table that I have :
<table class="nogap" cellpadding="1" bgcolor="#00000" cellspacing="1" style="margin:110px 0 0 5px; width:100%; border-color:#B6D6F6;" >
<tbody>
<?php include 'dbconn.php';?>
$con = mysqli_connect($host,$user,$pass,$db) or (header( 'Location: errorpage.php' ));
if (mysqli_connect_errno($con)) { header( 'Location: errorpage.php' ); }
$sql = "SELECT * FROM $tb1 ORDER BY (Serial_num +1) LIMIT $offset, $rowsperpage";
$result = mysqli_query($con, $sql) or (header( 'Location: errorpage.php' ));
$row = mysqli_num_rows($result);
while ($row = $result->fetch_assoc())
{
$product = $row['Prod_type'].$row['Serial_num'];
<tr id="mstrTable" class="lovelyrow">
<td width="5%"><?php echo $product;?></td>
<td width="5%"><?php echo $row['Customer'];?></td>
<td width="7%">
<a href="#"
onmouseover="ajax_showTooltip(window.event,'getptn.php?prd=<?php echo $p;?>',this);return false"
onmouseout="ajax_hideTooltip()">
<?php echo$row['Prod_info'];?>
</a>
</td>
</tr>
}
</table>
Thanks!
First of all don't give the same html id attribute to each row (mstrTable). Html Ids should be unique per page.
Instead mark table rows with unique ids, eg:
$html .= "<td id='row_".$row['id']."'>"
Then do a search query first, remember item id, figure out what page should be queried, query the whole page, attach classess 'greyedout' and 'highlighted' to rows accordingly and then you might try this javascript function to scroll down to the item:
https://developer.mozilla.org/en-US/docs/Web/API/element.scrollIntoView

Srpy dataset if decision based on value from different dataset

Many thanks for reading this.
I have asked as well in Adobe forums with no luck.
I am building a small library application for school books.
I have created a database with lets say 2 tables
Books ( ID_Book , Writer , Title , Copies) and
Loans ( ID_Book , Load_ID , Loan_Date ) etc
I have used correctly spry to create easily a table which print the book list in a table
with pagination .
var ds1 = new Spry.Data.XMLDataSet("ajaxquery.php", "root/row", {sortOnLoad: "Writer", sortOrderOnLoad: "ascending"});
ds1.setColumnType("ID_Book", "number");
var pv1 = new Spry.Data.PagedView( ds1 ,{ pageSize:10 });
var pv1PagedInfo = pv1.getPagingInfo();
pv1.setColumnType("ID_Book", "number");
I have made the necessary declarations to produce the dataset for the Loans
var ds3 = new Spry.Data.XMLDataSet("ajaxallloans", "root/row", {sortOnLoad: "ID_Book", sortOrderOnLoad: "ascending"});
ds3.setColumnType("ID_Book", "number");
ds3.setColumnType("ID_Dan", "number");
I would like to find a way to change the table row color for the BOOKS table IF an ID_Book is within the Loans table - ds3.
The table is created
<div spry:region="pv1" id="bibliapv">
<div spry:state="loading" class="loading" >Loading...</div>
<div spry:state="ready">
<table>
<tr >
<th width="75" spry:sort="ID_Book"> Book No</th>
<th width="123" spry:sort="Writer">Writer </th>
etc...
</tr>
<tr spry:repeat="pv1" spry:select="mySelectClass" spry:hover="hover">
<td >{ID_Book}</td>
<td>{writer}</td>
etc ..
</tr>
</table>
</div>
</div>
<div>
Many thanks again.
Dinos - Greece
Many thanks again for reading .
I found a solution based on the ideas drawn from
labs.adobe.com/technologies/spry/samples/data_region/CustomColumnsSam ple.html
I have added the following code:
created a css rule
lets say
.match {
background-color: #0CF;
}
In spry:region add the class {cssrule} which is added dynamically shortly after <tr class="{cssrule}" spry:repeat="pv1" spry:select="mySelectClass" spry:hover="hover">
3.
Then just before closing tag added (you could put it earlier in code)
<script type="text/javascript">
ds2.addObserver({
onPostLoad:function( ds2, data ){
var data = ds2.getData();
var pv1data = pv1.getData();
for( var i = 0; i < pv1data.length; i++ )
{
for (var j =0 ; j< data.length ; j++)
{ if ((data[j].Writer).toString()== (pv1data[i].Writer).toString() ) //or whatever you like!
{pv1data[i].cssrule="match"; }
}
}
}
});
</script>