User1988
User1988

Reputation: 1997

I want search functionality in yii

my code is here for searching in index.php

Search: <?php echo CHtml::textField(
        'search', 
        '',
        array(
            'style'=>'width:150px',
            'placeholder'=>Yii::t('app', 'User name...'),
            'onchange'=>'$.fn.yiiGridView.update("user-grid", {
                data: { "Users[username]": $(this).val() 
                    }
            });
            return false;'
        )); ?>

Its desinging enter image description here

Its properly searching username now i wnat to search first_name and last_name in this(same)box plz help me what to do changes for that

thanks in advance

Upvotes: 0

Views: 1151

Answers (1)

llamerr
llamerr

Reputation: 3186

data: { "Users[username]": $(this).val() }

should become

data: { "Users[username]": $(this).val(), "Users[first_name]": $(this).val(), "Users[last_name]": $(this).val() }

and maybe you should add AND or OR to your query

Upvotes: 2

Related Questions