How to treat textfield as integer field while adding sorting in views? I have a textfield in my content type. It have values like 1, 2, 3, ..., 10. While I adding sorting it sorts the content like 1, 10, 2, ...

I can write the custom handler for it, But how can I treat it as integer in sorting while adding a query. Currently sort handler implements the following query :

$this-&gt;query-&gt;add_orderby($this-&gt;table_alias, $this-&gt;real_field, $this-&gt;options['order']);


What change I have to do?
Solved it by adding a custom handler and used CAST Functions of mysql and changing the query to :

$this-&gt;query-&gt;add_orderby(NULL, 'CAST(' . $this-&gt;real_field . ' AS SIGNED)', $this-&gt;options['order']);