I want to have multiple sort on datatable. I find below link that seems more match on my case. Initial sortorder for Primeface datatable with multisort
But I have one field that have specified sorting. I have only three different values. e.g. TCS(first in sorting), School-input (second), self-input (third). Their sorting are not on letters as you see. How to handle this?? Do you have any suggestions to help me??
I have solved by adding one more parameter in the class of typeId which will be sorting. typeId is hardcoded assigned to different type string.
Related
I still have problem defining composite key in jqGrid. Even though I set the 3 fields that are the composite key with attribute 'editable: true', the jqGrid does not behave correctly. I haven't used any 'key=true' in any of the fields as the jqGrid document mentions it that not more than one field can use this attribute. When I point to one of the rows in the List View, jqGrid high lights two rows, instead of one row. Is there any other attribute I need to use to specify more than one field for the composite key.
The usage of composite key is very easy. The property id if input items is used by default as the key (rowid). Thus you need just fill the input data with id properties, which constructed from the 3 fields and some separator, like _ for example, which is not a part of the field. If you will have some implementation problems, then you need just include an example of input data and the composite key, which you want to have.
There are multiple knockoutJS resources which show how to sort objects over string values(ex. FirstName, LastName) but couldn't find way to sort using numeric values (ex. Marks, Salary, Age)
This jsfiddle has necessary data and I would like to sort objects in ascending as well as descending direction depending on field 'mark'
I tried using parseIntbut it's not working.
I think you forgot to invoke "mark" as observable here is a working version of your code http://jsfiddle.net/kuedwryz/1/
//use
right.mark()
//instead of
right.mark
I have this here:
Dim query = FromTableRows.Select(Function(Row) Row.Item(_SqlSyntaxChecker.SelectedFields(0)))
Row is a normal DataRow, so I can get the field value of the rows like this: Row.Item(0), Row.Item(1), etc.
SelectedFields contains the field names of the FromTableRows.
Now, I would like to select all the fields in the SelectedFields list, while the number of the selected fields can vary.
Is this possible? How should I modify the code?
Thanks.
You can simply make use of the ItemArray property, if I understand your question correctly.
FromTableRows.Select(Function(Row) Row.ItemArray)
The ItemArray property is an object array that contains the elements found in the DataRow. You will, of course, lose any mapping via this method from columns to elements, but it sounds like that's what you want.
hi i have a datatable with 2 columns one for id(unique) and another for "description". now i have a dropdownlist with "description" from the same datatable mentioned above. when users selects a particular item from description, i need to pick the id corresponding to the selected value. what is the easiest way to achieve this, should i use a foreach or datatable find method.
You should set the Dropdownlist's DataTextField to the Description and its DataValueField to the ID.
MyDropDownList.DataSource = MyDataTable
MyDropDownList.DataTextField = "Description"
MyDropDownList.DataValueField = "ID"
MyDropDownList.DataBind()
Then you can get the ID via MyDropDownList.SelectedValue.
firstly, you might want to give some more information- what programming language you're using (I'm assuming C#)
now, regarding what you've described, you probably want to use the datatable's find method, or, preferrably- use LINQ on the datatable.
table.First(x=> x.description == desc).Id;
(note that this code assumes that an element with a matching description exists. If such an element may not exist- use FirstOrDefault and check the return result for null value).
good luck.
A quick example of this can be found here
http://forums.asp.net/p/1590755/4029475.aspx
Using the answer provided above yoyuu would then use dropdownlist.selecteditem.value, hope this helps.
I know, that it is possible to filter dataTable Control on client as it is shown in this exaple:
http://developer.yahoo.com/yui/examples/datatable/dt_localfilter.html
Is it also possible to filter more columns? I'd like to have 2 textfields, and when I type sth to the first one, DataTable would filter according to the 'areacode' (from the example) and when I type sth to the second one, DataTable would filter according to the 'state'.
Is this possible somehow? Thanks for any help.
The simplest way to modify the existing example would be to build a request string that contains the information for each text box. For example (column1=a&colum2=b), modify the doBeforeCallback to split the request and do the filtering for each column.