jqxDropDownList set multiple item selected - jqwidget

we are use below code for multiple item checked from jqxDropdownlist.
for (var i = 0; i < parsedData[0].user.length; i++) {
window.jQuery('#user').jqxDropDownList('checkItem', parsedData[0].user[i] );
}
Could someone help for jqxDropdonwlist dynamically selected multiple value ?

With jqxDropDownList you must check multiple value when check property is true like described here:
jQWidgets: Properties

Related

Setting several "setValue" at once

I have some cells (that are non-adjacenet). Each of these has a range name in the form "rLampnn" as below.
ss.getRangeByName("rLamp20").setValue(e.range.getValue());
ss.getRangeByName("rLamp19").setValue(e.range.getValue());
ss.getRangeByName("rLamp18").setValue(e.range.getValue());
I want to put the same value into several of them at once. (Each of them then has a conditional format which changes the cell colour depending on what was entered into them).
Is there a more efficient way (i.e. quicker) of setting the same value into a group of these cells rather than individual calls like above?
If you have many of them you could loop .setValue() using the nn index in the named ranges:
var fName = 'rLamp';
var howManyNamedRanges = 20;
// Assuming the first NamedRange is rLamp0
for (var i=0;i<howManyNamedRanges;i++) {
ss.getRangeByName(fName+i).setValue(e.range.getValue());
}
If the first named ranges is 1 or else you could change it to:
var fName = 'rLamp';
var firstNamedRange = 4;
var lastNamedRange = 20;
// Assuming the first NamedRange is rLamp[n]
for (var i=firstNamedRange;i<=lastNamedRange;i++) {
ss.getRangeByName(fName+i).setValue(e.range.getValue());
}

Can't access colum value in QSqlQueryModel

i have some problem with changing value in QTableView cell.
ui->search_results->show();
int num = model->rowCount();
for (int i = 0; i<num; i++) {
QSqlRecord rec = model->record(i);
QString file_chron = rec.value(1).toString();
QString file_age = get_file_agestring_from_chron(file_chron);
//model->setData(model->index(i,1), QVariant(file_age), Qt::EditRole);
rec.setValue(1,file_age);
it seems that both functions work as they should in a loop
qDebug()<<rec.value(1).toString()+" "+rec.value(2).toString()+" "+rec.value(3).toString()+" "+rec.value(4).toString()+" "+rec.value(5).toString();
}
but outside we have old value.
qDebug()<<model->data(model->index(3,1)).toString();
ui->search_results->setModel(model);
ui->search_results->hideColumn(4);
i need to reimplement value inside this field.
I think that it is access error, but i can't understand how to set new value!
sorry, i can't add tag QSqlQueryModel
You are operation on QSqlRecord rec; which is copy of the record instead of the reference to it. As for setting data - see model : setData function

How do I iterate through a list of items in a Ext.dataview.List

I'm currently trying to find out how to set items to be selected on a list in ST2.
I've found the following:
l.select(0, true);
l.select(1, true);
which would select the first 2 items on my list. But the data coming from the server is in csv format string with the ids of the items in the list to be selected.
e.g. "4, 10, 15"
So I currently have this code at the moment.
doSetSelectedValues = function(values, scope) {
var l = scope.getComponent("mylist");
var toSet = values.split(",");
// loop through items in list
// if item in list has 'id' property matching whatever is in the toSet array then select it.
}
The problem is I can't seem to find a way of iterating over the items in the list and then inspect the "id" property of the item to see if it matches with the item in the array.
l.getItems()
Doesn't seem to return an array of items. The list is populated via a store with the "id" & "itemdesc" properties. I just want to be able to select those items from a csv string. I've scoured the Api on this and I can't seem to find a way of iterating over the items in the list and being able to inspect its backing data.
the Ext.List's items are not the items you are looking for. The items under the Ext.List object are those:
Ext.create('Ext.List', {
fullscreen: true,
itemTpl: '{title}',
store: theStore,
**items: [item1, item2]**
});
Granted, usually an Ext.List doesn't have items like these. What you are looking for are the Ext.Store items. The Ext.Store items are the exact same items in the same order as presented in the Ext.List.
To iterate over those, and select the corresponding items in the list, do the following:
var s = l.getStore();
var itemIndicesToSelect = [];
for (var i = 0 ; i < s.data.items.length ; i++){
if (arrayContainsValue(toSet, s.data.items[i].data.id)){
itemIndicesToSelect.push(i);
}
}
for (var i = 0 ; i < itemIndicesToSelect.length ; i++){
l.selectRange(itemIndicesToSelect[i], itemIndicesToSelect[i], true);
}
You would have to implement the function arrayContainsValue (one possible solution).
doSetSelectedValues = function(values, scope) {
var l = scope.getComponent("mylist"),
store = l.getStore(),
toSet = values.split(",");
Ext.each(toSet, function(id){
l.select(store.getById(id), true);
});
}

EPPLUS - Get Name Of Cell//Range

I know it is possible to give a cell a name, as answered in the following question:
EPPLUS - Rename Cell
How can you see if a given cell/range has a name and retrieve that name?
There is a property i.e. IsName that can determine the range has a name or not. But it seems not to work properly. I suppose you to query the named cells collection i.e. sheet.Names or book.Names (they contains all the names in the sheet or the book). Then compare FullAddressAbsolute to the given cell to get the named cell you want.
var cell = sheet.Cells["C1"]; // cell you wanna find the name
ExcelNamedRange namedCell = null;
foreach (var item in book.Names)
{
if (item.FullAddressAbsolute.Equals(cell.FullAddressAbsolute))
{
namedCell = item;
break; // if you don't wanna find all
}
}
// if (namedCell == null) --> NOT FOUND
// else
// namedCell.Name : contains the name you wanna retrieve
LINQ can also be used instead of the loop:
namedCell = book.Names.Where(item => item.FullAddressAbsolute.Equals(cell.FullAddressAbsolute)).FirstOrDefault();

Refresh a dijit.form.Select

First, you have to know that I am developing my project with Struts (J2EE
Here is my problem :
I have 2 dijit.form.Select widgets in my page, and those Select are filled with the same list (returned by a Java class).
When I select an option in my 1st "Select widget", I would like to update my 2nd Select widget, and disable the selected options from my 1st widget (to prevent users to select the same item twice).
I succeed doing this (I'll show you my code later), but my problem is that when I open my 2nd list, even once, it will never be refreshed again. So I can play a long time with my 1st Select, and choose many other options, the only option disabled in my 2nd list is the first I've selected.
Here is my JS Code :
function removeSelectedOption(){
var list1 = dijit.byId("codeModif1");
var list2 = dijit.byId("codeModif2");
var list1SelectedOptionValue = list1.get("value");
if(list1SelectedOptionValue!= null){
list2.reset();
for(var i = 0; i < myListSize; i++){
// If the value of the current option = my selected option from list1
if(liste2.getOptions(i).value == list1SelectedOptionValue){
list2.getOptions(i).disabled = true;
} else {
list2.getOptions(i).disabled = false;
}
}
}
Thanks for your help
Regards
I think you have to reset() the Select after you've updated its options' properties. Something like:
function removeSelectedOption(value)
{
var list2 = dijit.byId("codeModif2"),
prev = list2.get('value');
for(var i = 0; i < myListSize; i++)
{
var opt = myList[i];
opt.disabled = opt.value === value;
list2.updateOption(opt);
}
list2.reset();
// Set selection again, unless it was the newly disabled one.
if(prev !== value) list2.set('value', prev);
};
(I'm assuming you have a myList containing the possible options here, and the accompanying myListSize.)