SQL - Add a border bottom when column value changes - sql

I'm trying to add a border bottom red style to a table when the column value changes.
As shown in the picture, I want to add a bottom border when FamilyID changes it's value.
Any help is greatly appreciated and thank you in advance!

I actually just went about using a SQL workaround using the LAG command.
Used that as a flag to indicate when value has changed and set the CSS command for the event. Thanks #Piyush for the suggestion to use a flag!

I have implemented same thing on classic report of employee ,
you can check url https://apex.oracle.com/pls/apex/f?p=26095 with
userid: AMOL.PATIL#VYOMLABS.COM
pass : Unicorn#123
Code in execute JavaScript page load section:
var previous=null;
var flag;
$("td[headers=DEPTNO]").each(function() {
if(previous==null){
previous=$(this).text();
flag='true';
}
if($(this).text()==null ||$(this).closest('tr').next().find('[headers="DEPTNO"]').text()==null) {
}
else
{
if($(this).text()!=$(this).closest('tr').next().find('[headers="DEPTNO"]').text()) {
previous=$(this).text();
if(flag=='false')
flag='true';
else
{
flag='false';
}
}
if(previous==$(this).text()&& flag=='false') {
flag='true';
$(this).closest('tr').after('<tr><td></td><td></td><td></td></tr>');
$(this).closest('tr').next().addClass("myclass");
}
}
});
code for inline css section of page:
table.uReportStandard > tbody tr.myclass > td
{
background-color:red !important;
}
Output :
Similarly you can also implement same thing by just changing headers.In your case it may be FAMILYID which will replace DEPTNO here.
Please try this code ...

Related

How do I make the observe function work more than once?

I'm trying to create a slider that will update every time a slide is altered. I've got it set to observe, observeParents, and observeChildren, and it works the first time I show or hide slides, but it's only working once. Is there a good workaround for this?
Here's a link to the page with the slider on it. Click the color swatches to see what I'm talking about. Thanks in advance!
I figured out a workaround! I added a data-element called data-slides that updates on the container when you click to make the slideshow change, like so.
thumbnails.each(function() {
var wrapper = $(this);
container = $('.swiper-container');
color = colorLabel.val();
while (wrapper.parent().children().length === 1) {
wrapper = wrapper.parent();
}
if (jQuery(this).attr('alt') === optionValue) {
wrapper.fadeIn('500').show();
container.attr('data-slides', color);
} else {
wrapper.fadeOut('500').hide();
}
});
It triggers the observe function and allows it to update as necessary.

Trying to customize stepper of a spinner field Sencha extjs

I am trying to add a custom spinner logic to a spinner field I have. I have been able to customize the spinner in the "view" by using onSpinUp:.
I am looking to refer to the spin up step in the controller but I am not having success. I am unable to reach the debugger I have in the "spinner" function.
This is what I have so far, I am not sure what I am missing. Could someone shed light on this?
Thanks in advance.
`control:{
currentTime:{ //currenTime is the itemId
spinup: 'spinner' // spinner is the function name
},
}`
`
spinner: function (){
debugger;
}
`
I see that you have added single quotes, and I'm not sure if you code looks exactly like this, but your control object should look like:
//currenTime is the item id so it has to be wrapped
// with single quotes and it also needs a # prefix.
control:{
'container #currentTime': {
spinup: 'spinner' // spinner is the function name
}
Check fiddle: https://fiddle.sencha.com/#fiddle/uo1
Note: You need to add container #currentTime, just #currentTime won't work. It's a known issue with Sencha Touch.

Display prestahop customizable text only when a combination is selected

I have a shop with 2 combinations. Yes and No. I added a customizable text to my products but I would like this text area to appear only when "yes" is selected. Can someone please help me do this?
Thanks!
Edit:
Thank you for replying. My code looks like this now:
//init the serialScroll for thumbs
$('#thumbs_list').serialScroll({
items:'li:visible',
prev:'#view_scroll_left',
next:'#view_scroll_right',
axis:'x',
offset:0,
start:0,
stop:true,
onBefore:serialScrollFixLock,
duration:700,
step: 2,
lazy: true,
lock: false,
force:false,
cycle:false
});
$('#group_22').change(function() {
$('.idTab10').toggle();
});
Sadly it doesn't work. Nothing happens. The (Yes) select ID is 22. Please advise.
I suggest you do that with jQuery.
You just have to modify the file /themes/your_theme/js/product.js
In this file, search for:
$(document).ready(function()
{
...
});
At the end of it, add the following code:
toggleCustomization(); // We launch the function on page load
$('#group_4').change(function() { // We launch the function when select is changed
toggleCustomization();
});
And right after closing $(document).ready(function(), add this function :
function toggleCustomization() { // Hide or Show Customization Form and Tab
if($('#group_4').val() == '23') { // We hide Customization Form and Tab if No is selected
$('#idTab10').hide();
$('a[href="#idTab10"]').hide();
} else { // We show Customization Form and Tab if Yes is selected
$('#idTab10').show();
$('a[href="#idTab10"]').show();
}
};
Where:
group_4 is the id of your Yes-No select
idTab10 is the id of the bloc containing all information about your customization field
23 is the value of 'No' in your select

Create custom command to expand client detail template in Kendo UI Grid (MVC)

I've got a nested grid within my grid, and it works perfectly, but the client doesn't like to use the arrow on the left and asked for a button to be added in order to show the child grid.
The example on the Kendo website shows how to automatically open the first row, I just want a way to expand the grid from a custom control in the same way that the left selector does it.
I've got the custom command working, and it executes the sample code, but I just need some help with the javascript required to make it work for the current row.
columns.Command(command =>
{
command.Edit().Text("Edit").UpdateText("Save");
command.Destroy().Text("Del");
command.Custom("Manage Brands").Click("showBrandsForAgency");
And the js with the standard example of opening the first row:
function showBrandsForAgency(e) {
this.expandRow(this.tbody.find("tr.k-master-row").first());
}
Please help by giving me the js required to expand the row clicked and not the first row?
* EDIT *
Modified the solution provided by Atanas Korchev in order to get it to work on only the button and not the whole row.
I'd prefer a solution that uses the function showBrandsForAgency instead of a custom funciton but this does the job:
$(document).ready(function () {
$("#grid").on("click", "a", function (e) {
var grid = $("#grid").data("kendoGrid");
var row = $(this).parent().parent();
if (row.find(".k-icon").hasClass("k-minus")) {
grid.collapseRow(row);
} else {
grid.expandRow(row);
}
});
});
You can try something like this:
$("#grid").on("click", "tr", function(e) {
var grid = $("#grid").data("kendoGrid");
if ($(this).find(".k-icon").hasClass("k-minus")) {
grid.collapseRow(this);
} else {
grid.expandRow(this);
}
});
When using jQuery on the function context (available via the this keyword) is the DOM element which fired the event. In this case this is the clicked table row.
Here is a live demo: http://jsbin.com/emufax/1/edit
Same results just Simpler, faster, and more efficient:
$("#grid").on("click", "tr", function () {
$(this).find("td.k-hierarchy-cell .k-icon").click();
});

Calling member functions on click/tap within sencha touch 2 templates

I am rather new to sencha touch, I've done a lot of research and tutorials to learn the basics but now that I am experimenting I have run into a problem that I can't figure out.
I have a basic DataList which gets its data from a store which displays in a xtemplate.
Within this template I have created a member function which requires store field data to be parsed as a parameter.
I would like to make a thumbnail image (that's source is pulled from the store) execute the member function on click/tap.
I can't find any information on this within the docs, does anyone know the best way to go about this?
Here is a code example (pulled from docs as I can't access my actual code right now).
var tpl = new Ext.XTemplate(
'<p>Name: {name}</p>'
{
tapFunction: function(name){
alert(name);
}
}
);
tpl.overwrite(panel.body, data);
I want to make the paragraph clickable which will then execute the tapFunction() member function and pass the {name} variable.
Doing something like onclick="{[this.tapFunction(values.name)]} " does not seem to work.
I think functions in template are executed as soon as the view is rendered so I don't think this is the proper solution.
What I would do in your case is :
Add a unique class to your < p > tag
tpl : '<p class="my-p-tag">{name}</p>'
Detect the itemtap event on the list
In your dataview controller, you add an tap event listener on your list.
refs: {
myList: 'WHATEVER_REFERENCE_MATCHES_YOUR_LIST'
},
control: {
myList: {
itemtap: 'listItemTap'
}
}
Check if the target of the tap is the < p > tag
To do so, implement your listItemTap function like so :
listItemTap: function(list,index,target,record,e){
var node = e.target;
if (node.className && node.className.indexOf('my-p-tag') > -1) {
console.log(record.get('name'));
}
}
Hope this helps