Highlight orders with different status on orders page - magento

On the Magento Admin back end , Sales>orders it then it displays a list of orders . Based on the order status , I would like to assign different background to it , or any noticeable way to to visually differentiate different orders based on their status.
Like pending order have a Red Background or some red tick mark , while a completed order with green background or green tick and so on ..
Proper way or any quick fix will do either

Quick fix: app/code/core/Mage/Adminhtml/Block/Sales/Order/Grid.php, add this function:
public function getRowClass($row)
{
return $row->getStatus();
}
This adds the order's Status as a table row CSS class. Then you can throw some CSS into skin/adminhtml to do whatever you want with the row classes. To override the default background color I used this CSS:
.grid .data .<status> {background-color: somecolor;}

Related

Create PySimpleGUI list with a key

I wish to have a list of text items in a PySimpleGUI that I can update later. That is, I want to have a key for the list. This might be vertical or horizontal, and I do not know how many items there will be.
I end up with different use cases, but the current one is to make a single line of text items with different colors. Other times, I need to write and update a customized table, just different enough that the table widget does not work.
Conceptually, I want to do something like this:
layout = [ [sg.T('Titles and Things')], sg.ListThing(key='-data-', [[]]) ]
so that I can:
window['-data-'].update(values=[ [sg.T(v, color=c)] for (v,c) in my_data ])
Another, invalid syntax, way of saying what I want is to use [key="-data-", sg.T('Item1'), sg.T('Item2')].
Is this possible?
You can update individual layout elements but you cannot dynamically change the layout itself.
It is possible to create 2 or more elements, whereby only one of them is visible, and switch them later as needed. Or you can close and re-create the window with another layout. Or combine both approaches.
An example of switching layouts:
def change_layout():
left_col_1 = sg.Column([[sg.Text(f'Text {i}') for i in range(4)]], visible=True, key='col_1')
left_col_2 = sg.Column([[sg.Text(f'Text {i}')] for i in range(6)], visible=False, key='col_2')
visible_1 = True
layout = [[sg.Column([[left_col_1, left_col_2]]), sg.Button('Change layout', key='change')]]
window = sg.Window('window', layout=layout, finalize=True)
while True:
event, values = window.read()
print(event)
print(values)
print(visible_1)
if event in ('Exit', sg.WIN_CLOSED):
break
if event == 'change':
window['col_1'].update(visible=not visible_1)
window['col_2'].update(visible=visible_1)
visible_1 = not visible_1
Please notice that the alternative layouts for the left part (left_col_1, left_col_2) need to be enclosed in a container (column, frame) to keep their position in the window in the moment they are invisible.

SAPUI5 Panels - Controlling position of content

I have a number of Panels which, when expanded, show the corresponding questions for that particular 'Category'
The issue I have is, say for example I answer the questions for the 1st panel, the content will scroll down, eventually hiding the panel... fair enough.
However, when I click on the Next Category (Production Area), I need to the page to scroll back up to the first question in the Category, or maybe even just display the selected category at the top of the page.
Is this possible?
Currently, the user has to continually scroll back if when they select the next Category.
You can achieve it using scrollToElement()
var oPage = sap.ui.getCore().byId("pageId"); // you page ID
var oList = sap.ui.getCore().byId("ListId"); // element ID to which it has to scroll
if (oPage && oList) oPage.scrollToElement(oList, 1000);
Execute the above code inside the panel event expand.
you can try to use this control instead which suits your needs
https://sapui5.hana.ondemand.com/#/entity/sap.uxap.ObjectPageLayout
After trying everything, this is what worked for me.
onExpand: function (oEvent) {
if (oEvent.getParameters().expand) {
var focusID = oEvent.getParameter("id");
var elmnt = sap.ui.getCore().byId(focusID);
elmnt.getDomRef().scrollIntoView(true);

Customize Interactive Grid header using configuration object

I'm trying to set the background color of column headers in an Interactive Grid form. There are a couple of things that I've tried:
Assigned a static id to a column and made an inline css selector that targets that id - the outcome is that data cells only inherit those attributes while editing; header remains unaffected
Assigned a class to a column and made an inline css selector that targets that class - the outcome is that all data rows inherit those attributes; header still remains unaffected
I tried using the JavaScript Code option under Advanced that can use the configuration object and modify column behavior and appearance without much success. I managed to change column header text but nothing else. I suspect there is some member of that configuration object that affects header background color but I can't seem to find it.
So the question is:
How to customize Interactive Grid column header (namely, set its background color) using configuration object?
I suppose this might be considered a separate question, but if that turns out to be impossible, what would be the best alternative?
Re an alternative, if the change is static you can do it using page-level CSS. Each heading has a data-idx attribute whose value is a number unique within the grid. So if your IG region has the static ID "myRegion" then you can add CSS like the following to target a specific header:
#myRegion_ig th[data-idx="2"] {
background-color: #dff;
}
Or to make all IG headers on the page the same:
.a-GV-header {
background-color: #dff;
}
The first approach is problematic. It makes the change based on the position, not the particular column. If, for example, the first two columns in your grid are "First Name" & "Last Name", in that order. "First Name" would be data-idx = 1; "Last Name" would be data-idx = 2. If you assign the color blue to data-idx = 1 and green to data-idx = 2, then "First Name" will blue and "Last Name" will be green. However, if you swap then position of the two columns so that the order in your IG is "Last Name", "First Name", then "Last Name" will now be blue and "First Name" will be green.
The second approach works if you want to change the color of all the headers to only one color.

Hiding columns of handsontable from javascript

Is there any way i can hide HOT columns from javascript?
The requirement is such that the column to hide will come as a parameter in javascript and based on that the respective column will show hide accordingly.
The HOT has rowHeaders and colHeaders and the data with 20 columns.
Please advise.
OUTDATED SOLUTION
Ok I founnd a possible solution. I tested it out on my own system but it's actually quite simple.
You should be using a customRenderer in your columns option. Read up about this if you aren't already. The idea is that you're giving each cell its own renderer. In this custom function, you can do something like this:
var colsToHide = [3,4,6]; // hide the fourth, fifth, and seventh columns
function getCustomRenderer() {
return function(instance, td, row, col, prop, value, cellProperties) {
if (colsToHide.indexOf(col) > -1) {
td.hidden = true;
} else {
td.hidden = false;
}
}
}
What this renderer does is hide the cells that the var colsToHide specify. All you do now is add a DOM element that lets the user pick which and so every time the table gets rendered (which happens basically after any change, or manually triggered need be), the cells in the columns specified will be hidden, keeping the data array intact like you described. And when not in colsToHide they are re-rendered so make sure you get that working as well.
Here I implemented it with very basic functionality. Just enter the index of a column into the input fields and watch the magic happen.
http://jsfiddle.net/zekedroid/LkLkd405/2/
Better Solution: handsontable: hide some columns without changing data array/object

How to implement this logic flow?

ok, here is the story...
I have 3 textfield for user to select....
[textfield A][textfield B][textfield C]
and a confirm button, the user need to add three textfield, after that , the user need to click the confirm button.... but based on different select order, the result is different, for example:
A>B>C, I will show red.
When the user select in this order:
B>A>C I will show green.
When the user select in this order:
C>B>A I will show the color blue....
based on different user select order, it will show different color....
But the question is, when I add more and more textfield, how can I implement this logic?
First, I design to have an array , when the user select one textfield, I store the textfield id to array, when user select the second one, I will store in the array, until the user click confirm, I read back the array to display the color....
But I think it will become very big & messy when more and more textfield is added, any better ideas? Thank you.
It's a bit of a hack, but what I'd be inclined to do is store the selections in a string that gets appended to each time (starting with empty string of course), trimming to the rightmost x characters. Then you can do a simple switch/case statement to determine the color. For example (C# fragments, sort of):
string selectStr = string.Empty;
void Select(string btn) {
selectStr += btn;
selectStr = selectStr.Remove(0, btn.Length - 3);
}
void Confirm() {
switch (selectStr) {
case "ABC" : /* make red */ break;
case "BAC" : /* make green */ break;
// etc.
}
}

Resources