Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot sort listData in bootstrap.widgets.TbEditableDetailView #735

Open
ghost opened this issue Jan 9, 2014 · 1 comment
Open

Cannot sort listData in bootstrap.widgets.TbEditableDetailView #735

ghost opened this issue Jan 9, 2014 · 1 comment

Comments

@ghost
Copy link

ghost commented Jan 9, 2014

I am using TbEditableDetailView in Yii and I have an editable field that generates a html Select - The select list is from a different model. I am using the following code

'editable'=>array(
            'type'=>'select',
            'autotext'=>'auto', 
            'inputclass' => "span4",
            'source'=>CHtml::listData(TradeTitle::model()->findAll(array('condition'=>'id>:id','params'=>array(':id'=>0))), 'id', 'name'))),

It is the TradeTitle list I want to order by name not by id. I have tried

'source'=>CHtml::listData(TradeTitle::model()->findAll(array('order' => 'name')), 'id', 'name'))),

However this will not sort by name. If I use

'source'=>CHtml::listData(TradeTitle::model()->findAll(array('order' => 'name')), 'name', 'name')))

This will sort in alphabetical order but I need the id from the TradeTitle table not the name. It appears that I cannot sort the source for the editable select. Any suggestions as this would normally work in a basic dropdownlist in a form.

@amrbedair
Copy link
Contributor

I run the same code, and this one worked for me...
'source'=>CHtml::listData(TradeTitle::model()->findAll(array('order' => 'name')), 'id', 'name')
should work
what version you are using ...?
are you still facing the problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants