I have a DevExpress TcxDBLookupComboBox v12.1.5 with:
DataBinding.Datafile -> integer field
DataBinding.DataSource -> dbisam table
DropDownListStyle -> lsEditList
ImmediatePost -> true
ListFieldIndex -> 1
ListFieldNames -> itemcode; itemname
Item Code is a integer field, that I want to be retrieved to the connected dataset. However I want to search on the drop down list by the item's name
That is working, due the ListFieldINdex, however when I select the item on the drop down list it retrieve the itemcode and display the itemname on the edit box. That is not what I need.
I know I can change the DisplayValue using the OnValidate Event of the component, however I cant find how to retrieve the selected itemcode from the dropdownlist. Using the connected dataset field always return 0. ImmediatePost is not changing anything on the field. I am retrieving fields from the dataset using the FieldByName property.
How can i get the itemcode seleted to pass to the DisplayValue on the OnValidate?
Is there a better way to do this?
UPDATE:
I am now using the SyncMode, and by that I can easily get the itemcode from the record selected.
However I could not make the control work the way I need:
to enter the itemcode directly for direct access
to open the lookup for itemname search
display the ItemCode when the I find the search by itemname and the lookup list get closed
Related
I have a "name" column in a table that contains a persons full name (ie. first+last name). The objective is to sort the column based on the person's last name first, then first name. My initial naive approach for the textsorter function was
function (a, b){
const aSplit = a.split(' ');
const bSplit = b.split(' ');
const aReverse = aSplit[1] + aSplit[0];
const bReverse = bSplit[1] + bSplit[0];
return aReverse.localeCompare(bReverse);
}
Unfortunately, some of the names I have to sort have extraneous spaces in them, potentially in either the first name or last name field. So I have to support this in my sorting.
I am currently only using the combined first+last name string for display and sorting but I have access to the seperate name strings as well as a preformatted lastname, firstname version. I'd like to attach either of these to the <th> tags as a data attribute or something like that and sort using that instead of the actual value but I'm not sure how to go about accessing those attributes from within the textsorter function.
Maybe try this - when you build the table HTML, add the last name + first name into a data-text attribute of the cell. Tablesorter will automatically use that attribute over the actual text within the cell. See textAttribute option to allow changing that attribute name.
I'm trying to bind a INTEGER table field to the ITEMINDEX of a combobox.
The combobox have your items predefined at design time.
If I bind the SelectedValue with the Table field, the String related to the item, not your index, are passed, resulting in "not a integer value" exeception.
If I bind to the ItemIndex value, the link is UNIDIRECTIONAL, and I want a bidirectional bind.
There are a way of doing such binding?
i dont understand your problem but i can give ideas as i understand.Pls picture it nexttime. First,if you want to add FruitDB.datas to combobox use formattext or
//select x from fruit order by fruitid asc
cb>style= dropdownlist and CB>add(Trim(fruitname)+space(5)+inttostr(Fruitid));
(apple 1
pear 11
apricot 12)
create 2 function return string and integer
seek for first space to i integer i=posstr(' ',cmb.item[x]) and
fruitname = copy(cmb.item[x],i,0) and fruitid= copy(reversestr(cmb.item[x]),Length(cmb.item[x])-(length(fruitname)+5),0)
and create 1 function again for indexof items return integer like
seekincmb(fruitnm:string):integer
for id= 0 to iemcount -1do if fruitname(cmb.item[id]) = fruitnm then result:= id break;or if you need fruitid ,you can add it too.
you call them in cmbOnchange or OndrawItem or where you want.
if you wont search on combo,use cmb.drawitem and fruitname function for display item
if you want search on combo,put an editbox on combobox and fix edge, editonchange or keypress or keyup,seek cmb.itemindex:= seekincmb( edittext);
I have a field (OK) in my cxGrid which is displayed as a checkbox (properties : checkbox). It is an actual database field (boolean) in my SQLite database . Can I group this field so that the grid displays how many items are checked and how many are not (default for groups) ? Right now I managed only to count the items.
The display I have now is something like this :
I need to count checked and unchecked items. Is this possible at all?
EDIT :
In one similar program I have such a feature implemented below) :
Here the sum works since it sums up numbers. In this case I dont know how to sum up
true/false thing... The best next thing I came up in this example is this :
Just changed the field name from 'ok' to' urejeno' ....
Jquery UI's autocomplete has given the solution to searching through one column of a table. So if you get the source from a table with firstname field then you can only search with firstname.
But say you have more than one fields to search against like firstname, lastname, postcode, contactNumber. Then in that case how would you implement something like this for autosuggest.
I mean that user should be able to search with whatever field they like and the autosuggest should be able to give them the suggestions based on that.
Is this possible?
The source can be an array, a string or a function.
You'd have to write a custom function to read all the values in all the columns of the tables and store them in an array. Then call the .source method with your array.
For bonus points, a series of checkboxes above the search field would ask the user to search only those columns.
[ ] FirstName [X] Lastname [X] Department
_Smith_____
John Smith IT
Waylon Smithers Assistant to the Assistant Regional Manager
Jackie Brown Gunsmith
I am adding a new item to a list in SharePoint 2007. One of the columns is a lookup into another list. Here is the code:
li["LOOKUP"] = new SPFieldLookupValue(1,VALUE);
The entry in the list isn't correct and is always using the first value in the other list. When I look at the value of li["LOOKUP"] in the debugger all I get is "1".
VALUE is in the other list and it is the first column.
When adding items to a list only the id of the element from the list being looked up needs to be provided. It was always adding the first element because I always passed in "1". The following code looks up the value and then gets its id and passed this to the field:
SPListItemCollection lookup = LIST.GetItems(qry);
li["LOOKUP"] = lookup[0][SPBuiltInFieldId.ID].ToString();