Hello all,
just starting out with the igGrid and I have a problem.
In my data model, I have two properties, "price" (decimal number) and "currency" (string). I would like to display them together in one single column, like so:
Price100 EUR20 USD
I also need to be able to numerically sort the values.
Problem is, if I concatenate the values into a single property before binding the data, number sorting does not work since it is then handled as a string (100 would appear before 20).
Since I have several different currencies in the data (EUR, USD...) I can not just always resort to the currency of the current locale (otherwise the "currency" format option would work).
The formatter function could possibly be an option, but I can't find a way to get the value from the other property to append it.
Hello UIS 2 Developer 2,
Thank you for contacting Infragistics!
You may define an an Unbound column and set its values to the"price" data. And you may sort using this Unbound column.
In order to have a single column with appended "price" and "currency" data, you may use a Template column.
For more details, please refer to the following documentation:
http://help.infragistics.com/Help/NetAdvantage/jQuery/2012.1/CLR4.0/html/Creating%20a%20Basic%20Column%20Template%20in%20the%20igGrid.htmlhttp://ko.infragistics.com/products/jquery/sample/grid/unbound-columnhttp://ko.infragistics.com/products/jquery/sample/grid/column-hiding-on-initializationhttp://help.infragistics.com/Help/NetAdvantage/jQuery/2012.1/CLR4.0/html/igGrid_Configure_Column_Hiding.html
If you have any questions, please let me know as well.
Thank you, that helped. This is the settings for the column I ended up using:
{ headerText: "Price", key: "price", dataType: "number", format: "number", template: "${price} ${currency}" }
And the sorting still works!