Move the value along with the handle in dijit/form/HorizontalSlider - dojo

Currently i am getting the values upon sliding but I want to display the values along with the handle in dojo horizontal slider.
I am creating the slider like this
var slider = new HorizontalRangeSlider({
name : "slider",
value : startValue,
//starting and end values to the slider
minimum : endValue,
maximum : endValue,
intermediateChanges : true,
showButtons : false,
onChange : lang.hitch(this, "setValues")
}, this.slider).startup();
var sliderLabelsRule = new HorizontalRule({
container : "topDecoration",
style:"height:5px",
count : 2,
numericMargin: 1
}, this.sliderRule);
this.sliderLabelsRule.startup();
//create the labels object
var sliderLabelsTop = new HorizontalRuleLabels({
container : "topDecoration",
style : "font-size: 14px;",
//array that contains the label values
labels : array,
}, this.sliderLabelsTop);
sliderLabelsTop.startup();
And the template is like this
<div>
<div data-dojo-attach-point="slider">
<div data-dojo-attach-point="sliderRule"></div>
<ol data-dojo-attach-point="sliderLabelsTop"></ol>
</div>
</div>
Now i have to display the value upon sliding the slider rule just below the slider handle, How to do this in dojo?

We can make use of the HorizontalRangeSlider attach points and we can place the value that you want to show by placing there.
HorizontalSRangeSlider has two attach point sliderHandle and sliderHandleMax,we can place the value there like this,
this.horizontalSlider = new HorizontalRangeSlider({
name : "slider",
value : this.sliderMinMax,
minimum : this.sliderMinMax[0],
maximum : this.sliderMinMax[1],
intermediateChanges : false,
showButtons : false,
onChange : lang.hitch(this, "callOnchange")
}, this.slider);
this.horizontalSlider.startup();
this.horizontalSliderRule = new HorizontalRule({
container : "topDecoration",
style:"height:5px",
count : 2,
numericMargin: 1
}, this.sliderRule);
this.horizontalSliderRule.startup();
this.horizontalSliderRule.sliderHandle.innerHTML = value //your value to show

Related

How to show icon next to value in cloumn in aurelia slickgrid/slickgrid?

I want to show en edit icon next to value in Amount column. This is because the Amount column is actually editable.But to give that as a hint to user, i want to show some edit icon next to it. How to do that in aurelia slickgrid?
Or maybe there is a way to highlight a field on hover ?
I am using aurelia slickgrid and looking if there is some option in aurelia slickgrid itself.
Go to the aurelia slickgrid example link and click on the link of example's source code
When you open it, there is a method called defineGrids
/* Define grid Options and Columns */
defineGrids() {
this.columnDefinitions1 = [
...,
...,
...,
...,
...,
{ id: 'effort-driven', name: 'Effort Driven', field: 'effortDriven', formatter: myCustomCheckmarkFormatter, type: FieldType.number, sortable: true, minWidth: 100 }
];
... rest of the code
}
The row with id effort-driven is where the icons are placed. On the other words, when you push a data collection(usually array of json object) to the table, values of the data objects with key name effort-driven are given to column with id effort-driven. Furthermore, for each passed value to the column, the method myCustomCheckmarkFormatter reformat it(for example 0 -> false or null -> not filled) and place it to the corresponding table's cell. look at the below method:
// create my custom Formatter with the Formatter type
const myCustomCheckmarkFormatter: Formatter<DataItem> = (_row, _cell, value) => {
// you can return a string of a object (of type FormatterResultObject), the 2 types are shown below
return value ? `<i class="fa fa-fire red" aria-hidden="true"></i>` : { text: '<i class="fa fa-snowflake-o" aria-hidden="true"></i>', addClasses: 'lightblue', toolTip: 'Freezing' };
};
As you can see, when the method is called, it returns an icon such as <i class="fa fa-fire red" aria-hidden="true"></i> which is placed in the table's cell.
I added an edit icon next to Amount,
{
id: "Edit",
field: "edit",
excludeFromColumnPicker: true,
excludeFromExport: true,
excludeFromQuery: true,
excludeFromGridMenu: true,
excludeFromHeaderMenu: true,
minWidth: 30,
maxWidth: 30,
formatter: Formatters.editIcon,
},
and used this custom format from ghiscoding comment:
const customEditableInputFormatter: Formatter = (_row, _cell, value, columnDef, dataContext, grid) => {
const isEditable = !!columnDef.editor;
value = (value === null || value === undefined) ? '' : value;
return isEditable ? `<div style="background-color: aliceblue">${value}</div>` : value;
};
The result is as shown in the picture.

dijit/form/FilteringSelect not working in phone

i have a drop down using dijit/form/FilteringSelect which is not supporting in mobile but it is working on web. i need my drop down to work in both web and mobile.can any one help
require(
[ "dojo/store/Memory", "dijit/form/FilteringSelect", "dojo/domReady!"],
function(Memory, FilteringSelect) {
var filteringSelect = new FilteringSelect({
id : "statusList",
value : "id",
style : "width: 150px;",
maxLength: "50",
placeHolder : "-- select one --",
displayedValue : defaultStatus,
onChange : setStatusId,
store : dataStore,
}, "statusList");
filteringSelect.startup();
});
You should have a look to dojox/mobile/SearchBox widget.
It'll do the same job than dijit/form/FilteringSelect with approximately the same configuration (You can pass to it the same datastore).

Update Owl Carousel 'Page' on Event + Bootstrap Tabs

I am trying to use both Owl Carousel and Bootstrap to create tabs that have a continuous carousel for the tab navigation. I also want these tabs to cycle automatically.
Here is a visual reference:
And here is a fiddle:
https://jsfiddle.net/j28md74n/
The main JS that I'm using (i've commented out the areas where i'm stuck):
var owlTab = $(".tab-carousel.owl-carousel");
owlTab.owlCarousel({
navigation: false,
dots:true,
navigationText: [
"<i class='fa fa-angle-left'></i>",
"<i class='fa fa-angle-right'></i>"
],
items : 4,
lazyLoad : false,
autoPlay : false,
draggable: true,
stopOnHover : true,
paginationSpeed : 1000,
transitionStyle:"fade",
responsive: true,
loop: true,
rewindNav: true,
});
$( document ).ready(function() {
if ($('.tab-carousel.owl-carousel').length){
$('.tab-carousel.owl-carousel .owl-item').attr("role", "presentation");
$('.tab-carousel.owl-carousel .owl-item:first-child').addClass('active');
};
$( ".tab-carousel.owl-carousel .owl-item" ).click(function() {
$( ".tab-carousel.owl-carousel .owl-item" ).removeClass('active');
$(this).addClass("active");
});
});
var tabCarousel = setInterval(function() {
var tabs = $('.tab-carousel.owl-carousel .owl-item'),
active = tabs.filter('.active'),
next = active.next('.owl-item'),
toClick = next.length ? next.find('a') : tabs.eq(0).find('a');
var indexNum = active.index();
console.log(indexNum);
if (indexNum > 2){
$('.owl-pagination .owl-page:eq(0)').removeClass("active");
$('.owl-pagination .owl-page:eq(1)').addClass("active");
// Here's where I want to change the owl carousel 'page'...to page '2'
};
if (indexNum <= 2){
$('.owl-pagination .owl-page:eq(0)').addClass("active");
$('.owl-pagination .owl-page:eq(1)').removeClass("active");
// Here's where I want to change the owl carousel 'page' ...to page '1'
};
toClick.trigger('click');
}, 6000);
I'm able to accomplish most of what I want, however, when the '.active' '.owl-item' is the 5th item or above (i.e. on the another owl carousel 'page') that the owl carousel 'page' updates as well. There are 4 items per owl carousel 'page.' Currently, the way I have it, if the '.owl-item' cycles through past the 5th item, the owl carousel page stays on the first one.
Thanks in advance for any insights!
Not sure, but i think the problem is the way you're determining the indexNum..
I had to reconfig how to find current index, but this could work.
working example.
function animationLoop() {
// Increment Active IDX each Loop
activeIdx++;
// Reset Active IDX if > tabs.length
if ( isEnd( activeIdx, tabs ) ) setIdx( 0 );
console.log("Current IDX", activeIdx);
// Click on the current active index
$(carouselItems[ activeIdx ]).find('a').trigger('click');
// console.log("Clicking This", carouselItems[ activeIdx ].innerText);
// Reset Loop
setTimeout(animationLoop, 3000);
}

Dojo gridx: using "onAfterRow" disables "onCellWidgetCreated"?

When creating a gridx, I use the following column definition to insert an Edit button in to the last cell of each row:
var editColumn = { field : 'Edit', name : '', widgetsInCell: true,
onCellWidgetCreated: function(cellWidget, column){
var btn = new Button({
label : "Edit",
onClick : function() {
console.log('Do stuff here');
});
btn.placeAt(cellWidget.domNode);
}
};
columns.push(editColumn);
var grid = new Grid({
cacheClass : Cache,
store : store,
structure : columns,
modules: ["gridx/modules/CellWidget"]
}, 'gridNode');
grid.body.onAfterRow = function(row){
...do stuff on the row here
};
Whne I include the onAfterRow function the row processing happens but the OnCellWidgetCreated does not. Each function seems wo work in absence of the other. Any suggestions on how I can: (1) format the rows according to row data AND (2) insert the button widgets in the last cell of each row?
Ok, solved it. Rather than assign the grid.body.onAfterRow, the way that worked for me was:
aspect.after(grid.body,'onAfterRow',function(row){
key = row.id;
if ('anulada' in row.grid.store.get(key)){
if(row.grid.store.get(key).anulada == true){
row.node().style.color = 'gray';
}
}
},true);
You need to require "dojo/aspect".

Titanium search view nor sorting out

I 'm using Android Titanium Appcelerator.
I had created a search bar for a tableview but it does not sorting the table values, please help:
var search = Titanium.UI.createSearchBar({
showCancel : false,
});
TableView = Ti.UI.createTableView({
search : search,
searchHidden : true,
filterAttribute : 'filter',
});
And I have added filter = contents; inside my rowview.
This is the basic code. I append all the text I want to search on into the filter of the tableRow definition. I then set the filter attribute of my tableROW to the filterAttribute of the tableVIEW.
var tableRow = Ti.UI.createTableViewRow({
height : '70dp',
layout : 'vertical',
filter : filterByThis1 + ' ' + filterByThis2
});
var search = Ti.UI.createSearchBar({});
var tableView = Ti.UI.createTableView({
filterAttribute : 'filter',
search : search
});