Yii framework: what does this JQuery line of code means(Yii 框架:这行 JQuery 代码是什么意思)
问题描述
<块引用>可能的重复:
抱歉,我对Yii框架不太了解,祝你好运!
Possible Duplicate:
Yii framework: Using data from related Active Record models for searching
Yii provide advanced search functionality under admin page.
This picture explain my question well.
This functionality shown on the picture is carried out by following code sample.
$('.search-form form').submit(function(){
$.fn.yiiGridView.update('order-grid', {
data: $(this).serialize()
});
return false;
});
There is a form with class attribute named search-form
where we provide search criteria. Based on the search criteria, it update the grid view called order which is generated by following code sample.
<?php $this->widget('zii.widgets.grid.CGridView', array(
'id'=>'order-grid',
'dataProvider'=>$model->search(),
'columns'=>array(
'id',
'order_create_date',
'price',
'bank_account_number',
'hardwaredetail_Id',
'user_id',
'user.name',
'user.email',
),
}
Order table has a relationship with user table. i want to perform search functionality on user's name and email address. But Advanced search functionality Auto generate code only for search on order table. i am trying to customize advanced search to be able to search on relational data as well
Thanks in advance for any help
I'm not super sure what you're asking or if it's possible, but let me try and explain what is going on in your current code eample:
$('.search-form form').submit(function(){
$.fn.yiiGridView.update('order-grid', {
data: $(this).serialize()
});
return false;
});
- When you submit the form by hitting the search button jQuery stops the form from submitting.
- Instead, it will submit it using the $.fn.yiiGridView.update function.
- $(this).serialize() takes all of the data from the form and puts it into a format that's easy for the server to read.
As for the other code sample it just creates the HTML for the form with an id of 'order-grid'.
Now, on to what you're hoping to do instead. I've looked for some examples and docs about the $.fn.yiiGridView.update
, which might be able to shed light on this. Here's what I've got:
- http://tech.ldg.me/yii-php-framework-snippets
- http://code.google.com/p/zii/source/browse/trunk/widgets/assets/gridview/jquery.yiigridview.js?r=65
- http://www.yiiframework.com/doc/api/1.1/CGridView
Sorry, I don't know more about the Yii framework and good luck!
这篇关于Yii 框架:这行 JQuery 代码是什么意思的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Yii 框架:这行 JQuery 代码是什么意思
基础教程推荐
- 如何在 XAMPP 上启用 mysqli? 2021-01-01
- HTTP 与 FTP 上传 2021-01-01
- Doctrine 2 - 在多对多关系中记录更改 2022-01-01
- 在 CakePHP 2.0 中使用 Html Helper 时未定义的变量 2021-01-01
- 在 yii2 中迁移时出现异常“找不到驱动程序" 2022-01-01
- 找不到类“AppHttpControllersDB",我也无法使用新模型 2022-01-01
- phpmyadmin 错误“#1062 - 密钥 1 的重复条目‘1’" 2022-01-01
- PHP 守护进程/worker 环境 2022-01-01
- 使用 PDO 转义列名 2021-01-01
- 如何在 Symfony 和 Doctrine 中实现多对多和一对多? 2022-01-01