IcCube - Leaves in Pivot table - pivot

If I have a parent-child-dimension, whose data I show in the IcCube/PivotTable and I want to show the leaves only (with descendants([categories].[categories].[All-M],,leaves)), those leaves are shown hierarchically. So a level5 leave of one category is suddenly the parent of a level6 leave of the next category.
Is there a way to "flatten" this tree, so that those leaves are all shown on one level and not sorted in the tree wrongly?
EDIT:
Here is a query:
SELECT
NON EMPTY { [Measures].[group_quality] } ON COLUMNS,
NON EMPTY { TopCount(descendants([categories].[categories].[Level$0].[Portal],,leaves),30,[Measures].[revenue_potential]) } ON ROWS
FROM [Cube]
All categories in the picture are leaves, so none of them has any children.

As workaround for that case you can use simple CSS dirty-hack.
1) First of all under Widget option tab of your widget you should set Hide icons to yes.
2) After this, to avoid collision with other Pivot Tables, add custom CSS class
3) Add these styles to Report CSS.
.pt-flattened .pt-hcont{
margin-left: 0 !important
}

Related

Tabulator GroupBy problems

Good afternoon. Please tell me how to solve the following problems.
I added a menu to the column headers of the table, when clicked, grouping by the selected column should occur. But for some reason, grouping occurs only after re-selecting this menu item. This happens once after the table is created. Then the menu is triggered the first time. Next, the grouping is triggered by the first click of the menu item.
After adding grouping by columns, the table starts working very slowly. Scrolling in the horizontal direction is jerky and has a long delay, while scrolling vertically remains acceptable. If you select grouping by different columns several times, the browser starts to take up a lot of RAM. The code and video example are below. And even if we remove the grouping, the lags remain when scrolling. It is worth using the grouping once and the Tabulator becomes difficult to use.
UPD: This is actual for Chrome. An if table include 'Frozen' columns.
Code of header menus
var headerMenu = [
{
label:"Группировка",
action:function(e, column){
let gField = column.getDefinition().field;
if(table.options.groupBy === gField){
table.setGroupBy();
}
else {
table.setGroupBy(gField);
}
}
},
]
Adding menus example
arrCol.push({
title: 'Работник',
field:"fio",
sorter:"string",
headerFilter:"list",
bottomCalc:"count",
headerMenu: headerMenu,
bottomCalcParams:{precision:0},
headerFilterParams:{valuesLookup:"active",autocomplete:true},
frozen:true,
width: 200
});
Creating Table
table = new Tabulator("#spreadsheet", {
columnDefaults:{
headerHozAlign:"center",
},
height:"65vh",
columns: arrCol,
columnCalcs:"both",
groupClosedShowCalcs:true,
});
Video showcase

How to change tabulator Pagination buttons text and position

First part of the question is I want to simply change the original buttons "First", "Prev" and so on to some other text.
here is a link that shows original btns.
My second part of the question is how can i display the pagination in a footer out side the table
such as:
<table></table>
<div class:"footer">
pagination
</div>
There are several options you can use to change the pagination setup
Button Text
If you are looking to change the text, then the localisation system allows you to change any text for any part of the table, for full details see the Localization Documentation
var table = new Tabulator("#example-table", {
locale:"en-gb",
langs:{
"en-gb":{
"pagination":{
"page_size":"Page Size", //label for the page size select element
"first":"First", //text for the first page button
"first_title":"First Page", //tooltip text for the first page button
"last":"Last",
"last_title":"Last Page",
"prev":"Prev",
"prev_title":"Prev Page",
"next":"Next",
"next_title":"Next Page",
},
}
},
});
Button Position
If you simply want to change the position of the pagination element within the footer you can use CSS. The Styling Documentation contains a full list of classes used for styling the pagination elements.
To move the elements to the left hand side of the footer for example you would ned to use the following CSS:
.tabulator .table-footer{
text-align:left;
}
External Footer Element
if you want Tabulator to put the pagination elements into an element outside of the table, then you just need to pass the query selector for the element into the footerElement property in the table constructor. The Footer Layout Documentation contains full details on this.
In the example below i am assuming you have an element outside the table with an id of "my-footer" that you want the elements to appear in:
var table = new Tabulator("#example-table", {
footerElement:"#my-footer",
});
Here is the first part of the question:
$(".tabulator-paginator").find($(".tabulator-page[title='Next Page']")).text('>');
$(".tabulator-paginator").find($(".tabulator-page[title='Last Page']")).text('>>');
$(".tabulator-paginator").find($(".tabulator-page[title='First Page']")).text('<');
$(".tabulator-paginator").find($(".tabulator-page[title='Prev Page']")).text('<<');
As far as the second part tabulator have to keep the footer inside the table for it's javascript(the one the does pagination) to work. Hopefully in future updates it would let us do that, as it would provide more ability to custom the css.

Appcelerator adding elements before and after specific elements

Using appcelerator, how do you go about inserting elements before and after specific elements. Such as
<View id='element'>Some Content</View>
Using $.element.add() the new element will be inside it but i need it to go either before or after. In simple terms is there an equivalent to .before and.after in jQuery?
Many thanks
You can use the method insertAt (docs).
If the parent view's layout is horizontal or vertial, then you'll see the children views displayed according to their array positions.
There are 2 workarounds for insert elements before the actual views:
Save the $.elements.children in a array, and unshift the new elements to the array, and add all those views in array to the $.elements;
While you adding the views, set the left or top property (depending on your design), and every time you add a new child, run a loop of the children and increase their left or top property; ex (child views with 200):
$.elements.children[0].left = 0;
$.elements.children[1].left = 200;
$.elements.children[2].left = 400;

disable *some* checkboxes in a column in a GXT Grid

I have a GXT Grid showing some "User" objects. One of the columns holds checkboxes (CheckboxCell) . I need to disable a checkbox for 1 particular user and leave others enabled.
I tried extending CheckboxCell class - it's useless because it does not know the context (which User is renders): it only knows about true/false state.
tried
GridView view = table.getView();
Element cell = view.getCell(0, 1);
cell.setAttribute("disabled", "disabled");
-no luck. the disabled attribute is set on the outer "td" tag instead of the child "input" element.
tried cell.getChild..() methods - they all throw "method does not exist" exceptions.
UPDATE: I ended up creating my own CheckboxCellWhichCanBeDisabled class extending AbstractEditableCell. I'm afraid there's no other way.

magento exclude bundled items from search results

Currently, when one searches for an item, the quick search also brings up any bundles that contain items that fit the search criteria. How would I stop this?
A solution that filters out all bundled items from search results all together would be fine too.
UPDATE
I don't want the items to show in either the catalogue or search, but am using them as upsell items. This seems to leave two options:
I could amend the search results controller to omit bundled items (the method I was asking about), or
I could change the Upsell.php script to include "Don't show individually" items.
The second is perhaps easier? Currently the filter applied is:
Mage::getSingleton('catalog/product_visibility')->addVisibleInSearchFilterToCollection($this->_itemCollection);
How would I change this so it shows don't show individually items?
Apologies for the incomplete initial question.
Second Update:
Ok, I've added
->setVisibility(null)
and it already has
->addStoreFilter()
But there is no change.
Essentially, if I don't have either of:
Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($this->_itemCollection);
Mage::getSingleton('catalog/product_visibility')->addVisibleInSearchFilterToCollection($this->_itemCollection);
Then I get the following error:
SELECT 1 AS status, e.entity_id, e.type_id, e.attribute_set_id, price_index.price, price_index.tax_class_id, price_index.final_price, IF(price_index.tier_price IS NOT NULL, LEAST(price_index.min_price, price_index.tier_price), price_index.min_price) AS minimal_price, price_index.min_price, price_index.max_price, price_index.tier_price, e.name, e.short_description, e.sku, e.price, e.special_price, e.special_from_date, e.special_to_date, e.manufacturer, e.manufacturer_value, e.small_image, e.thumbnail, e.news_from_date, e.news_to_date, e.tax_class_id, e.url_key, e.required_options, e.image_label, e.small_image_label, e.thumbnail_label, e.price_type, e.weight_type, e.price_view, e.shipment_type, e.links_purchased_separately, e.links_exist, e.is_imported, e.rc_manufacturer, e.rc_manufacturer_value, e.rc_vehicle, e.rc_vehicle_value, e.rc_assembly_type, e.rc_assembly_type_value, e.surface_type, e.surface_type_value, e.rc_drive, e.rc_drive_value, e.rc_scale, e.rc_scale_value, e.rc_motor_type, e.rc_motor_type_value, e.rc_engine_start_type, e.rc_engine_start_type_value, e.rc_engine_size, e.rc_engine_size_value, e.rc_form_factor, e.rc_form_factor_value, e.rc_frequency, e.rc_frequency_value, e.rc_gear_material, e.rc_gear_material_value, e.rc_operation, e.rc_operation_value, e.rc_torque_6v, e.rc_torque_6v_value, e.rc_speed_6v, e.rc_speed_6v_value, e.rc_bearing_type, e.rc_bearing_type_value, e.rc_waterproofing, e.rc_waterproofing_value, e.rc_battery_application, e.rc_battery_application_value, e.rc_input_supply, e.rc_input_supply_value, e.rc_power_output_amps, e.rc_power_output_amps_value, e.rc_power_output_watts, e.rc_power_output_watts_value, e.rc_lead_connector_type, e.rc_lead_connector_type_value, e.rc_gear_pitch, e.rc_gear_pitch_value, e.rc_nitro_content, e.rc_nitro_content_value, e.rc_exhaust_type, e.rc_exhaust_type_value, e.rc_engine_starter_type, e.rc_engine_starter_type_value, e.rc_head_fitting, e.rc_head_fitting_value, e.rc_temperature_rating, e.rc_temperature_rating_value, e.rc_oil_type, e.rc_oil_type_value, e.rc_container_size, e.rc_container_size_value, e.rc_class, e.rc_class_value, e.rc_paint_application, e.rc_paint_application_value, e.rc_size, e.rc_size_value, e.rc_colour, e.rc_colour_value, e.rc_pack_contents, e.rc_pack_contents_value, e.rc_spare_part_type, e.rc_spare_part_type_value, e.rc_oil_weight, e.rc_oil_weight_value, e.rc_glue_type, e.rc_glue_type_value, e.rc_usage, e.rc_usage_value, e.rc_tool_type, e.rc_tool_type_value, e.rc_engine_spare_type, e.rc_engine_spare_type_value, e.rc_tune_up_type, e.rc_tune_up_type_value, e.rc_bearing_pack_type, e.rc_bearing_pack_type_value, e.rc_driver_type, e.rc_driver_type_value, e.rc_nut_type, e.rc_nut_type_value, e.rc_plane_type, e.rc_plane_type_value, e.rc_boat_type, e.rc_boat_type_value, e.pre_order, e.pre_order_value, e.msrp_enabled, e.msrp_display_actual_price_type, e.msrp, links.link_id, link_attribute_position_int.value AS position FROM catalog_product_flat_1 AS e
INNER JOIN catalog_product_index_price AS price_index ON price_index.entity_id = e.entity_id AND price_index.website_id = '1' AND price_index.customer_group_id = 0
INNER JOIN catalog_product_link AS links ON links.linked_product_id = e.entity_id AND links.link_type_id = 4
LEFT JOIN catalog_product_link_attribute_int AS link_attribute_position_int ON link_attribute_position_int.link_id = links
I've also tried the following, but get the error:
Mage::getSingleton('catalog/product_status')->addSaleableFilterToCollection($this->_itemCollection);
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($this->_itemCollection);
Thanks for the help.
Based on your updated question:
If you are not using Enterprise Edition TargetRule or some other module which automates upsells (i.e. the upsells are defined explicitly by the admin), then likely the simplest approach is that which you've specified - rewrite the Upsell block to not add the visibility filter. As a guess, to be optimal you may want to call setVisibility(null) and addStoreFilter() on the collection to trigger normal limiting behavior.
EDIT: Original answer below
Admin > Catalog > Manage Products grid
Choose "Bundle Product" from the filters area at the top, click "Search"
Click "Select All"
Select "Update Attributes" from the mass action block's "Action" dropdown, click "Submit"
Change the "Visibility" attribute to "Catalog"
I solved it by modifying the custom module so that I didn't need to worry about this. It may be of some use as it involved using:
$collection->addAttributeToFilter('type_id', array('neq' => 'bundle'));
Which just excludes all bundle items from a collection.

Resources