Yii CgridView批量删除


在我的许多模型的CgridViews中,我都具有批量删除功能:chechboxColumn和一个删除按钮,用于删除所有选中的用户。 为此,我在管理员中使用ajax,在控制器中使用新动作。</ p>

在我向gridview添加分页之前,所有这些工作都很好,这不会保存前几页中选中的行。</ p>

  'enableHistory'= true,
但是它什么也没做(根据我的阅读,我不是唯一的:mellow:),所以我下载了这个扩展名:selgridview </ p>

该扩展程序有效-当我浏览页面时,选中的行保持选中状态,但批量删除功能仅看到我当前所在页面的选中行。</ p>

这是我正在使用的ajax:</ p>

     Yii :: app()-> clientScript-> registerScript('delete','
                     varchecked = $(“#person-grid”)。yiiGridView(“ getChecked”,“ person-grid_c11”);
                     var count = checked.length;
                     if(count> 0 && Confirm(“您确定要删除” + count +“个人吗?”))
                                     $ .ajax({
                                                     url:“'。CHtml :: normalizeUrl(array('person / remove'))。'”,
                                                     success:function(data){$(“#person-grid”)。yiiGridView(“ update”,{});},
</ code> </ pre>

我什至不确定问题出在ajax中。 。 。 。 </ p>

非常感谢您的帮助:rolleyes:</ p>
     </ div>



In many of my Models' CgridViews I have a bulk delete function: a chechboxColumn and a delete button which deletes all the checked users. For that I am using ajax in the admin and a new action in the controller.

All this works fine until I add pagination to th gridview, which is not saving the checked rows in the previous pages.

I tried to use 'enableHistory'=true, but it did nothing (and from what I'v read I'm not the only one :mellow: ) , so I downloaded this extension: selgridview

The extension works - when I move through the pages , the checked rows stay checked BUT , my bulk delete function is seeing only the checked rows of the page I'm in right now.

this is the ajax I'm using:

                    var checked=$("#person-grid").yiiGridView("getChecked","person-grid_c11");
                    var count=checked.length;
                    if(count>0 && confirm(" are you sure you want to delete "+count+" people ? "))

Now , maybe thats a silly question but I know little about javascript. I'm not even sure that the problem is in the ajax . . . .

Help would be much appreciated :rolleyes:


我正在使用 selgridview扩展。</ p>

这是我删除所选用户的代码</ p>

     var selected = $(“#users-grid”)。selGridView(“ getAllSelection”);


     如果(!确认('确定要删除'+ selected.length +'users?'))返回false;

     var multipledeleteUrl =“ <?php echo Yii :: app()-> baseUrl;?> / users / multipledelete”;

     $ .ajax({
         输入:“ POST”,

             $(“#users-grid”)。selGridView(“ clearAllSelection”);

             $ .fn.yiiGridView.update(“ users-grid”);

</ code> </ pre>

UsersController </ code>上, actionMultipleDelete()</ code>做类似的事情</ p>

 如果(Yii :: app()-> request-> isAjaxRequest)
             $ selectedUsers = Yii :: app()-> request-> getPost('selectedUsers');

             foreach($ selectedUsers作为$ id)
</ code> </ pre>
     </ div>



I am using selgridview extension.

Here is my code for deleting the selected users

//delete multiple users at once
$('#delete_selected_items_button').on('click', function () {
    var selected = $("#users-grid").selGridView("getAllSelection");

    //if nothing's selected
    if ( ! selected.length)
        alert('Please select minimum one user to be deleted');
        return false;

    if ( ! confirm('Are you sure to delete ' + selected.length + ' users?')) return false;

    var multipledeleteUrl = "<?php echo Yii::app()->baseUrl;?>/users/multipledelete";

        type: "POST",
        url: multipledeleteUrl,
        data: {selectedUsers : selected},
        success: (function (e){

            //just to make sure we delete the last selected items

            //we refresh the CCGridView after success deletion

        error: (function (e) {
            alert("Can not delete selected users");

On UsersController, actionMultipleDelete() do something like this

if (Yii::app()->request->isAjaxRequest)
            $selectedUsers = Yii::app()->request->getPost('selectedUsers');

            //iterate through all ids
            foreach ($selectedUsers as $id)
                //delete the user here...

  1. 我不知道这个插件以及它如何保存哪些复选框
    交给您的控制器。</ li>
  2. 或者,您可以保存应将哪些模型
    在会话中删除。 在复选框上单击()(检查复选框是否已选中
    会话中模型的ID。 然后,当用户单击删除时,您可以
    从会话中检索此数据。</ li>
    </ ol>
         </ div>



  1. I don't know about this plugin and how it saves what checkboxes are checked, but you can look into that and then send that information to your controller.
  2. Alternatively you can save which models should be deleted in a session. On a checkbox click() (check if the check box is checked or unchecked) event call your controller with ajax to save the model's id in your session. then when the user clicks delete you can retrieve this data from the session.

Csdn user default icon
Yii CGridView批量编辑/更新?

<div class="post-text" itemprop="text"> <p>I want to edit/update, multiple rows together in Yii CGridView. Say, each row has a checkbox and a single edit/update button, I select multiple rows and by clicking on edit/update button all selected rows are opened for editing and update.</p> <p>Is this possible with Yii CGridView..??</p> </div>

Yii CGridView搜索“&”包含属性

<div class="post-text" itemprop="text"> <p>I am using Yii 1.1.15 framework.</p> <p>I can't search &amp; as a symbol in a attribute (ex. brand_name) in the query string. If I enter &amp; symbol the URL looks like this:</p> <pre><code>localhost/doctors/brand/?brand[brand_name]=&amp;&amp;brand[brand_status]= </code></pre> <p>Here the case is <code>brand[brand_name]=&amp;</code>. It does not consider the <code>&amp;</code> and is taken as the next parameter termination, if i just encode that character, it becomes: <code>%26</code> so the url becomes <code>localhost/doctors/brand/?brand[brand_name]=%26&amp;brand[brand_status]=</code> and it gives the correct result.</p> <p>But how to encode the yii CGridView filter text data?</p> <p>Thanks in advance. </p> </div>

Yii Cgridview动态列

<div class="post-text" itemprop="text"> <p>I am looking at customising the yii cgridview. I want to be able to allow users to select which columns they wish to see. Currently I am selecting the exact columns which will be displayed.</p> <p>I have had a look for information on this but do not seem to be getting very far, maybe I am not looking for the correct terms or their is a specific term for this. Ideally users can click a button and tick the boxes which will be seen. I have seen this implemented on x2crm </p> <p><a href="http://demo.x2engine.com/index.php/accounts/index" rel="nofollow">http://demo.x2engine.com/index.php/accounts/index</a></p> <p>I also like the ability to move the columns around ie resort the order of the columns and the ability to resize the columns when more are added. I realise someone isn't going to come along and do this for me, but certainly if someone could provide me any information or similar requests, it would be greatly appreciated. </p> </div>

Yii CGridView呈现新页面而不是AJAX

<div class="post-text" itemprop="text"> <p>In the index page of my site I have floating div-block with CGridView inside.</p> <p>I need to use sort, filter, paging etc. options, but only via updating this only div and not refreshing the whole page.</p> <p>Data rendering as it should, i'm stuck only with updating grid contents - all <code>&lt;a&gt;</code>'s have href, that sending user to specified view.</p> <p>Here's the view for grid: (it's the only content of my views.users.usersGrid.php)</p> <pre><code>$this-&gt;widget('zii.widgets.grid.CGridView', array( 'dataProvider' =&gt; $model-&gt;search(), 'filter' =&gt; $model, 'ajaxUrl' =&gt; 'modules/subcntrl/usersGrid', 'ajaxUpdate' =&gt; 'users-grid', 'columns' =&gt; array( array( 'name' =&gt; 'name', 'type' =&gt; 'raw', 'value' =&gt; 'CHtml::encode($data-&gt;name)' ), array( 'class'=&gt;'CButtonColumn', ), ), )); </code></pre> <p>It's called from views.users.users.php: <code>&lt;?php $this-&gt;actionUsersGrid(); ?&gt;</code></p> <p>Controller:</p> <pre><code>public function actionUsers() { $this-&gt;renderPartial('users'); } public function actionUsersGrid() { if(!Yii::app()-&gt;request-&gt;isAjaxRequest) die('Url should be requested via ajax only'); $model = new Users(); $this-&gt;renderPartial('usersGrid',array( 'model' =&gt; $model, )); } </code></pre> <p>Would appreciate any help</p> </div>

Yii CGridview没有过滤

<div class="post-text" itemprop="text"> <p>I'm trying to work with a YII CGridview to display some data.</p> <p>This is home my model search function looks like:</p> <pre><code>/** * Retrieves a list of models based on the current search/filter conditions. * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions. */ public function search() { $criteria=new CDbCriteria; $criteria-&gt;compare('ip',$this-&gt;ip,true); $criteria-&gt;compare('first_use',$this-&gt;first_use,true); $criteria-&gt;compare('last_use',$this-&gt;last_use); $criteria-&gt;compare('memberid',$this-&gt;memberid); $criteria-&gt;compare('countryid',$this-&gt;countryid); return new CActiveDataProvider(get_class($this), array( 'criteria'=&gt;$criteria, )); } </code></pre> <p>And this is how my view looks like</p> <pre><code>$this-&gt;widget('zii.widgets.grid.CGridView', array( 'id'=&gt;'iplog-grid', 'dataProvider'=&gt;$oIPLog-&gt;search(), 'filter'=&gt;$oIPLog, 'summaryText' =&gt; 'showing you {start} - {end} of {count} logged Ips', 'columns'=&gt;array( array( 'name'=&gt;'ip', 'type'=&gt;'raw', ), array( 'name'=&gt;'first_use', 'type'=&gt;'datetime', ), array( 'name'=&gt;'last_use', 'type'=&gt;'datetime', ), ), )); </code></pre> <p>Displaying the CGridview works, but I can't seem to get the filter on top of it to work. It sends the call and I don't get any error as reponse, it just returns the whole unfiltered data again..</p> <p>Any clues?</p> </div>

如何防止Yii cgridview中关于过滤器字段的默认ajax回调[关闭]

<div class="post-text" itemprop="text"> <p>I am using Yii1.1 Cgridview.</p> <p>I have added filters to cgridview.The problem is that filters have default ajax callback on keypress of input field.</p> <p>How can I prevent this default ajax callback on filter fields in Yii cgridview and provide search button submit for filters search?</p> </div>

更新后无法拖动Yii CGridview行

<div class="post-text" itemprop="text"> <p>I am using below link for sorting CGridview row,</p> <p><a href="http://www.yiiframework.com/wiki/238/creating-a-jqueryui-sortable-cgridview/" rel="nofollow">http://www.yiiframework.com/wiki/238/creating-a-jqueryui-sortable-cgridview/</a></p> <p>its working fine, but after grid update i cannot able to drag the grid row !</p> <p>My code,</p> <pre><code>$('#basefilter-grid table').sortable({ forcePlaceholderSize: true, forceHelperSize: true, items: 'tr', update : function () { serial = $('#basefilter-grid table').sortable('serialize', {key: 'order[]', attribute: 'class'}); $.ajax({ 'url': '" . $this-&gt;createUrl('baseContact/orderFilterRow') . "', 'type': 'post', 'data': serial, 'success': function(data){ $.fn.yiiGridView.update('basefilter-grid'); }, 'error': function(request, status, error){ alert('We are unable to set the sort order at this time. Please try again in a few minutes.'); } }); }, helper: fixHelper }).disableSelection(); </code></pre> <p>I have column 'order' after row dragged its gets updated, after grid refresh only updated value will be seen, so i need to update grid badly, can anyone say how to do this?</p> </div>

Yii Cgridview过滤器输入框搜索后不显示搜索字符串

<div class="post-text" itemprop="text"> <p>i'm facing an issue with the filter input box in CGridView. So the filter is showing the correct result after entering the search string in the filter input box and hitting enter, but the input box is getting cleared after the result is being shown. This makes it quite inconvenient for the user to see what they was searching for because the filter input box is empty while the grid shows the correct search results.</p> <p>Here are the code.</p> <p>entry view name ::newsReleases.php</p> <pre><code> &lt;?php $this-&gt;widget('bootstrap.widgets.TbGridView', array( 'id' =&gt; 'product-news-grid-' . $id, 'itemsCssClass' =&gt; 'table table-striped', 'htmlOptions' =&gt; array( 'class' =&gt; 'news-datagrid', ), 'dataProvider' =&gt; $dataProvider-&gt;searchProductNews($symbol), 'filter' =&gt; $dataProvider, 'enableHistory' =&gt; false, 'ajaxUpdate' =&gt; 'product-news-grid-' . $id, 'ajaxUrl' =&gt; Yii::app()-&gt;createUrl('/realTime/AjaxUpdateProductNews'), 'pager' =&gt; array( 'header' =&gt; '', 'cssFile' =&gt; false, 'maxButtonCount' =&gt; 5, 'selectedPageCssClass' =&gt; 'active', 'hiddenPageCssClass' =&gt; 'disabled', 'firstPageCssClass' =&gt; 'previous', 'lastPageCssClass' =&gt; 'next', 'firstPageLabel' =&gt; '&lt;&lt;', 'lastPageLabel' =&gt; '&gt;&gt;', 'prevPageLabel' =&gt; '&lt;', 'nextPageLabel' =&gt; '&gt;', ), 'summaryCssClass' =&gt; 'label label-warning', 'columns' =&gt; array( array( 'name' =&gt; 'headlines', 'header' =&gt; 'Headlines', 'value' =&gt; function($data) { return '&lt;div class="product-news"&gt; &lt;a target="_blank" href="' . $data-&gt;link . '" &gt; ' . $data-&gt;headlines . '&lt;/a&gt;&lt;/div&gt;'; }, 'type' =&gt; 'raw', ), array( 'name' =&gt; 'publish_date', 'header' =&gt; 'Date', 'value' =&gt; function($data) { return '&lt;span class="news-pub-date"&gt;' . $data-&gt;publish_date . '&lt;/span&gt;'; }, 'type' =&gt; 'raw', ) ) )); ?&gt; &lt;!-- Now this script had to be included again in order to make the ajax sorting and pagination work, or else none of the ajax functionality is working. Remember when getting stuck with ajax update in grid views always use this script --&gt; &lt;script type="text/javascript" src="/ProductAnalysis/assets/dd5f9a70/gridview/jquery.yiigridview.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; /*&lt;![CDATA[*/ jQuery(function($) { jQuery('[data-toggle=popover]').popover(); jQuery('body').tooltip({ "selector": "[data-toggle=tooltip]" }); jQuery('#product-news-grid-' + $('#symbol-id').text()).yiiGridView({ 'ajaxUpdate': ['product-news-grid-' + $('#symbol-id').text()], 'ajaxVar': 'ajax', 'pagerClass': 'pagination', 'loadingClass': 'grid-view-loading', 'filterClass': 'filters', 'tableClass': 'table table-striped', 'selectableRows': 1, 'enableHistory': false, 'updateSelector': '{page}, {sort}', 'filterSelector': '{filter}', 'url': '/ProductAnalysis/index.php/realTime/AjaxUpdateProductNews', 'pageVar': 'News_page', 'afterAjaxUpdate': function() { jQuery('.popover').remove(); jQuery('[data-toggle=popover]').popover(); jQuery('.tooltip').remove(); jQuery('[data-toggle=tooltip]').tooltip(); $('#News_headlines').change(function() { var inputVal = $(this).val(); $('#News_headlines').val(inputVal); }); } }); }); /*]]&gt;*/ &lt;/script&gt; </code></pre> <p>Here is the controller action named AjaxUpdateProductNews</p> <pre><code>public function actionAjaxUpdateProductNews() { $dataProvider = new News(); $dataProvider-&gt;unsetAttributes(); if (isset($_GET['News'])) { $dataProvider-&gt;attributes = $_GET['News']; } $id = explode("-", $_GET["ajax"]); $realTime = RealTime::model()-&gt;findByPk($id[count($id) - 1]); $this-&gt;renderPartial('_newsView', array( 'dataProvider' =&gt; new News(), 'symbol' =&gt; $realTime-&gt;symbol, 'id' =&gt; $realTime-&gt;id, 'headlines' =&gt; $_GET['News']['headlines'], 'publish_date' =&gt; $_GET['News']['publish_date'] )); } </code></pre> <p>and here is the view _newsView </p> <pre><code> &lt;?php $this-&gt;widget('bootstrap.widgets.TbGridView', array( 'id' =&gt; 'product-news-grid-'. $id, 'itemsCssClass' =&gt; 'table table-striped', 'htmlOptions' =&gt; array( 'class' =&gt; 'news-datagrid', ), 'dataProvider' =&gt; $dataProvider-&gt;searchProductNewsSymbol($symbol, $headlines, $publish_date), 'filter' =&gt; $dataProvider, 'enableHistory' =&gt; false, 'ajaxUpdate' =&gt; 'product-news-grid-'. $id, 'ajaxUrl' =&gt; Yii::app()-&gt;createUrl('/realTime/AjaxUpdateProductNews'), 'pager' =&gt; array( 'header' =&gt; '', 'cssFile' =&gt; false, 'maxButtonCount' =&gt; 5, 'selectedPageCssClass' =&gt; 'active', 'hiddenPageCssClass' =&gt; 'disabled', 'firstPageCssClass' =&gt; 'previous', 'lastPageCssClass' =&gt; 'next', 'firstPageLabel' =&gt; '&lt;&lt;', 'lastPageLabel' =&gt; '&gt;&gt;', 'prevPageLabel' =&gt; '&lt;', 'nextPageLabel' =&gt; '&gt;', ), 'summaryCssClass' =&gt; 'label label-warning', 'columns' =&gt; array( array( 'name' =&gt; 'headlines', 'header' =&gt; 'Headlines', 'value' =&gt; function($data) { return '&lt;div class="product-news"&gt; &lt;a target="_blank" href="'. $data-&gt;link .'" &gt; '. $data-&gt;headlines .'&lt;/a&gt;&lt;/div&gt;'; }, 'type' =&gt; 'raw', ), array( 'name' =&gt; 'publish_date', 'header' =&gt; 'Date', 'value' =&gt; function($data) { return '&lt;span class="news-pub-date"&gt;'. $data-&gt;publish_date .'&lt;/span&gt;'; }, 'type' =&gt; 'raw', ) ) )); ?&gt; </code></pre> <p>Now like i said the filter is showing the result, but the input box is getting cleared after it shows the result. I tried to reinsert the val in the input box using jQuery's change() handler, but it doesn't works.</p> <p>Please provide any sort of advice on how to retain the search string value in the filter box. Oh, btw other grids on the sites are working flawlessly, so its not a problem with missing files.</p> <p>Thanks in advance, Maxx </p> </div>

自定义排序/向下Yii CGridView按钮

<div class="post-text" itemprop="text"> <p>so, I want to make a new button in my CGridView. This is up &amp; down arrow buttons which is will be used for sorting my articles. I've read a lot of how to make this kind of buttons. I already read the wiki of how to use this CGridView button also in <a href="http://www.yiiframework.com/wiki/106/using-cbuttoncolumn-to-customize-buttons-in-cgridview/" rel="nofollow">this link</a>. </p> <p>And now I have this in my view :</p> <pre><code>array( 'header' =&gt; 'Action', 'class' =&gt; 'CButtonColumn', 'template' =&gt; '{moveup}{movedown}{view}{delete}', 'htmlOptions' =&gt; array('style' =&gt; 'width: 68px'), 'buttons' =&gt; array ( 'moveup' =&gt; array ( 'label' =&gt; 'Move Up', 'imageUrl' =&gt; Yii::app()-&gt;request-&gt;baseUrl . '/images/move_up.png', 'url' =&gt; 'Yii::app()-&gt;createUrl("KB/moveup", array("id"=&gt;$data-&gt;KBID))', 'visible' =&gt; '$data-&gt;KBORDER == KB::model()-&gt;getMax()', ), 'movedown' =&gt; array ( 'label' =&gt; 'Move Down', 'imageUrl' =&gt; Yii::app()-&gt;request-&gt;baseUrl . '/images/move_down.png', 'url' =&gt; 'Yii::app()-&gt;createUrl("KB/movedown", array("id"=&gt;$data-&gt;KBID))', 'visible' =&gt; '$data-&gt;KBORDER == KB::model()-&gt;getMin()', ), ), ), </code></pre> <p>and this one in my model :</p> <pre><code> public function getMax(){ $sql = 'SELECT MAX(KBORDER) FROM KB'; $max = Yii::app()-&gt;db-&gt;createCommand($sql); $max-&gt;queryAll(); return $max; } public function getMin(){ $sql = 'SELECT MIN(KBORDER) FROM KB'; $min = Yii::app()-&gt;db-&gt;createCommand($sql); $min-&gt;queryAll(); return $min; } </code></pre> <p>All that codes running just fine. except for the visibility. I want to make the up button become invisible when it has the highest value of KBORDER or when it position is in the 1st place. And for the down button, it supposed to be invisible too when it has the lowest value of KBORDER or when it position is in the last place. but, when I put that code in my 'visible', all the buttons are invicible. so my question is, <strong>how to make my request happen?</strong> </p> <p>thanks in advance</p> </div>

Yii CGridView:selectionChanged未定义

<div class="post-text" itemprop="text"> <p>I'm stuck with a problem on my CGridView. I want to make columns clickable, so that it redirects to a new page.</p> <p>My problem is that I try to use <code>selectionChange</code>, and Yii throws an exception telling <code>Property "CDataColumn.selectionChanged" is not defined.</code></p> <p>Here is my code: </p> <pre><code>&lt;?php $this-&gt;widget('zii.widgets.grid.CGridView', array( 'dataProvider'=&gt;$dataProvider, 'columns'=&gt;array( array('header'=&gt;'First Name' , 'type'=&gt;'raw' , 'htmlOptions'=&gt;array('style'=&gt;'cursor: pointer;') , 'name'=&gt;'first_name' , 'sortable'=&gt;true , 'selectionChanged'=&gt;'function(id){window.location=\'CHtml::link($data["first_name"],Yii::app()-&gt;createUrl("/athlete/view", array("id"=&gt;$data["id"])))\'}'), array('header'=&gt;'Last Name' , 'htmlOptions'=&gt;array('style'=&gt;'cursor: pointer;') , 'type'=&gt;'raw' , 'name'=&gt;'last_name' , 'selectionChanged'=&gt;'function(id){window.location=\'CHtml::link($data["first_name"],Yii::app()-&gt;createUrl("/athlete/view", array("id"=&gt;$data["id"])))\'}'), array('header'=&gt;'Date of Birth' , 'value'=&gt;'Controller::date($data["dob"])' , 'htmlOptions'=&gt;array('width'=&gt;'90px', 'style'=&gt;'cursor: pointer;') , 'name'=&gt;'dob' , 'selectionChanged'=&gt;'function(id){window.location=\'CHtml::link($data["first_name"],Yii::app()-&gt;createUrl("/athlete/view", array("id"=&gt;$data["id"])))\'}'), array( 'header'=&gt;'Edit' ,'class'=&gt;'CButtonColumn' ,'template'=&gt;'{update}' , 'updateButtonUrl'=&gt;'Yii::app()-&gt;createUrl("/athlete/update", array("id"=&gt;$data["id"]))' ), ), 'pagerCssClass'=&gt;'clist-pager', 'pager'=&gt;array('header'=&gt;''), )); ?&gt; </code></pre> <p>So, could you help me figure out why this exception is thrown, and fix it?</p> </div>

Yii CGridView过滤器

<div class="post-text" itemprop="text"> <p>I want CGridView's filter to work with multiple words in one column at the time. For example i want to show all rows with "A" in first column plus all the rows with "B" in the same column.</p> <p>Does anybody know which class and function should i override to do this?</p> </div>

如何根据数据值Yii CGridView为行着色

<div class="post-text" itemprop="text"> <p>I have Users model.</p> <p>Displaying it with CGridView i want to color the rows depending on <code>$model-&gt;is_admin</code> which is an integer either 0 or 1, so either of 2 colors.</p> <p>Could it be done by simple settings of CGridView ? </p> <p><strong>Controller</strong></p> <pre><code>/** * Lists all models. */ public function actionIndex() { $model = new Users('search'); $model-&gt;unsetAttributes(); // clear any default values if (isset($_GET['Users'])) $model-&gt;attributes = $_GET['Users']; $this-&gt;render('index', array( 'model' =&gt; $model, )); } </code></pre> <p><strong>View</strong></p> <pre><code>&lt;div class="row"&gt; &lt;div class="col-sm-12 table-responsive"&gt; &lt;?php $this-&gt;widget('zii.widgets.grid.CGridView', array( 'id' =&gt; 'users-grid', 'itemsCssClass' =&gt; 'table table-bordered table-hover dataTable', 'dataProvider' =&gt; $model-&gt;search(), 'enablePagination' =&gt; false, // 'filter'=&gt;$model, 'columns' =&gt; array( 'username', 'first_name', 'last_name', 'email', ), array( 'class' =&gt; 'CButtonColumn', ), ), )); ?&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> </div>

Yii Cgridview列按钮可见性

<div class="post-text" itemprop="text"> <p>I am creating hospital System..</p> <p>Here when admitted patient's discharge date is null, then only i want to make visible DISCHARGE button in Cgrid view CColumn Button.</p> <p>discharge date is going into <strong><em>indoor</em></strong> model.</p> <p>PatientController Code:</p> <pre><code>public function actionAdmin() { $model=new Patient('search'); $discharge_date=Indoor::model()-&gt;find(array('condition'=&gt;'patient_id=:id','params'=&gt;array(':id'=&gt;????????????))); $model-&gt;unsetAttributes(); // clear any default values if(isset($_GET['Patient'])) $model-&gt;attributes=$_GET['Patient']; $this-&gt;render('admin',array( 'model'=&gt;$model, 'discharge_date'=&gt;$discharge_date-&gt;discharge_date, )); } </code></pre> <p>patient/admin:</p> <pre><code>array( 'class'=&gt;'CButtonColumn', 'template'=&gt;'{update} {view} {collection} {discharge}', 'buttons'=&gt;array ( 'collection' =&gt; array ( 'label'=&gt;'Collection', 'url'=&gt;'Yii::app()-&gt;createUrl("invoice/index", array("id"=&gt;$data-&gt;id))', 'options'=&gt;array('class'=&gt;'btn btn-success btn-mini'), ), 'discharge' =&gt; array ( 'label'=&gt;'Discharge', 'url'=&gt;'Yii::app()-&gt;createUrl("invoice/index", array("id"=&gt;$data-&gt;id))', 'options'=&gt;array('class'=&gt;'btn btn-info btn-mini'), 'visible'=&gt;'is_null($discharge_date)?true:false;' ), ), </code></pre> <p>please tell should i use for loop to get each patient's id in controller?? now i have written '?????????' for it..</p> <p>n what is error in visible code???</p> <p>thanks in advance..</p> </div>

Yii cgridview,更新网格后未能选择行

<div class="post-text" itemprop="text"> <p>I am using gridview in yii and a form on top of grid view so that when update button is clicked it will show the value on the form. I can highlight the row after update button is clicked using this javascript</p> <pre><code>function updateDetail(url) { $.getJSON(url, function(data) { $('#TransactionDetail_id').val(data.id); $('#TransactionDetail_transactionFk').val(data.transactionFk); $('#TransactionDetail_itemName').val(data.itemName); $('#TransactionDetail_itemFk').val(data.itemFk); $('#item-name-saved').val(data.itemName); $('#TransactionDetail_quantity').val(data.quantity); $('#TransactionDetail_itemUnit').val(data.unit); $('#TransactionDetail_unitPrice').val(data.unitPrice); $('#mySubmitButton').html('&lt;i class="icon-ok icon-white"&gt;&lt;/i&gt; Simpan'); $('html,body').scrollTop(0); var rowId = "#row-" + $('#TransactionDetail_id').val(); var curRow = $(rowId).get(0); $(curRow).trigger('click'); }); } </code></pre> <p>The last row can make the row is selected (highlighted). However, when I am finish with updating, I have difficulty to highlight the last updated row. Using code below, </p> <pre><code>function formDetailSaved(data) { if (data.status == "success") { $.fn.yiiGridView.update('detail-grid'); $('#TransactionDetail_itemName').val(""); $('#TransactionDetail_itemFk').val(""); $('#item-name-saved').val(""); $('#TransactionDetail_quantity').val(""); $('#TransactionDetail_itemUnit').val(""); $('#TransactionDetail_unitPrice').val(""); $('#mySubmitButton').html('&lt;i class="icon-plus icon-white"&gt;&lt;/i&gt; Tambah'); var rowId = "#row-" + $('#TransactionDetail_id').val(); $('html,body').animate({scrollTop: ($(rowId).offset().top - 100)}, 500); // delete id to reset update $('#TransactionDetail_id').val(""); toastr.success(data.message, data.title); var curRow = $(rowId).get(0); $(curRow).trigger('click'); } else { toastr.error(data.message, data.title); } $('input:visible:enabled:first').focus(); } </code></pre> <p>From Firebug I can see that the row is selected but somehow it is being refresh again. Hence, the selected is removed. Any one can help on this? The idea is to show which row has been updated since I am not using pagination and the row can be 100-200.</p> <p>Thank you in advance.</p> </div>

Yii CGridView无法显示自定义SQL属性

<div class="post-text" itemprop="text"> <p>In the <code>Type</code> model's <code>search()</code> function, I want to display three attributes in CGridview:</p> <p><code>type.name</code>, <code>type.description</code> and <code>count(dataset_type.dataset_id)</code></p> <pre><code>public function search() { // Warning: Please modify the following code to remove attributes that // should not be searched. $criteria=new CDbCriteria; $criteria-&gt;alias='t'; $criteria-&gt;select='t.name, t.description, count(dataset_type.dataset_id) as number'; $criteria-&gt;join='LEFT JOIN dataset_type ON dataset_type.type_id=t.id'; $criteria-&gt;group='t.id'; return new CActiveDataProvider($this, array( 'criteria'=&gt;$criteria, )); } </code></pre> <p>This is the view:</p> <pre><code>&lt;?php $this-&gt;widget('zii.widgets.grid.CGridView', array( 'id' =&gt; 'type-grid', 'dataProvider' =&gt; $model-&gt;search(), 'filter' =&gt; $model, 'itemsCssClass' =&gt; 'table table-bordered', 'columns' =&gt; array( 'name', 'description', 'number', array( 'class'=&gt;'CButtonColumn', ), ), )); ?&gt; </code></pre> <p>but in this way the columns in CGridView can only display model attributes, it shows <code>type.number</code> can't find in model <code>Type</code>, how can I display the <code>count()</code>?</p> </div>

jquery太多的递归yii cgridview

<div class="post-text" itemprop="text"> <p>I have 2 CGridView calling each other on <code>beforeAjaxUpdate</code>. I can i prevent the recursion. i only want it to call the other one once?</p> <p><strong>jobs-grid</strong></p> <pre><code>'beforeAjaxUpdate' =&gt;'function(id,options){ var x = getQueryParams(options.url); var data = "sort="+x.Jobs_sort + "&amp;ajax=detailsgeoscan-grid"; $.fn.yiiGridView.update("detailsgeoscan-grid",{data:"sort="+x.Jobs_sort}); }', </code></pre> <p><strong>detailsgeoscan-grid</strong></p> <pre><code>'beforeAjaxUpdate' =&gt;'function(id,options){ var x = getQueryParams(options.url); var data = "Jobs_sort="+x.Jobs_sort + "&amp;ajax=jobs-grid"; $.fn.yiiGridView.update("jobs-grid",{data:"sort="+x.Jobs_sort}); }', </code></pre> </div>

如何使用yii cgridview在单元格中添加somthing值?

<div class="post-text" itemprop="text"> <p>I need add name and date and user image in one cell. I tried code below and some another way. But I got only errors</p> <pre><code>'columns'=&gt;array( array('name'=&gt;'sender', 'value'=&gt; '"' . $model[key?]-&gt;name . $model[key?]-&gt;date .'"'), ) </code></pre> <p>Is this task perhaps solve? Maybe do I need use another widget or create my own widget?</p> </div>

php yii CGridView 选中一行实现页面跳转

在整个页面中有CGridView 的行, 比如现在url是index.php?r=FlPackageSell/create 实现选中CGridView中的<input type=checkbox....> 以后url变成 index.php?r=FlPackageSell/create&selectdel=8 其中8是你选择的行的id

如何防止Yii CGridView过滤器改变?

<div class="post-text" itemprop="text"> <p>CGridView have active filter with "change" event. So every time i type something in one filter and leave this field it will change results on list.</p> <p>I want to prevent this behavior and make CGridView filters only when user hits "enter" key.</p> <p>So i could type values in 3 different filters and then hit enter to show results.</p> <p>How can i do that?</p> </div>

java jdk 8 帮助文档 中文 文档 chm 谷歌翻译

JDK1.8 API 中文谷歌翻译版 java帮助文档 JDK API java 帮助文档 谷歌翻译 JDK1.8 API 中文 谷歌翻译版 java帮助文档 Java最新帮助文档 本帮助文档是使用谷


本课程内容系统、全面、简洁、通俗易懂,通过2个多小时的介绍,让大家对软件测试有个系统的理解和认识,具备基本的软件测试理论基础。 主要内容分为5个部分: 1 软件测试概述,了解测试是什么、测试的对象、原则、流程、方法、模型;&nbsp; 2.常用的黑盒测试用例设计方法及示例演示;&nbsp; 3 常用白盒测试用例设计方法及示例演示;&nbsp; 4.自动化测试优缺点、使用范围及示例‘;&nbsp; 5.测试经验谈。

汽车行驶工况构建2019 D题.zip

1. 标记0与0之间的片段位置 2.标记所之间的毛刺数的位置 3.去掉毛刺数据 速度 并生成 新的数组 4.标记时间段 5. 0与0之间 如果有不连续的时间片段 置零 先找到时间间隔 再看间隔时间对应



面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?



<p> 限时福利限时福利,<span>15000+程序员的选择!</span> </p> <p> 1、原价 115 元,限时特价仅需 49 元!<br> 2、购课后添加学习助手(微信号:csdnxy68),按提示消息领取编程大礼包!并获取讲师答疑服务! </p> <p> <br> </p> <p> 套餐中一共包含5门程序员必学的数学课程(共47讲) </p> <p> 课程1:《零基础入门微积分》 </p> <p> 课程2:《数理统计与概率论》 </p> <p> 课程3:《代码学习线性代数》 </p> <p> 课程4:《数据处理的最优化》 </p> <p> 课程5:《马尔可夫随机过程》 </p> <p> <br> </p> <p> 哪些人适合学习这门课程? </p> <p> 1)大学生,平时只学习了数学理论,并未接触如何应用数学解决编程问题; </p> <p> 2)对算法、数据结构掌握程度薄弱的人,数学可以让你更好的理解算法、数据结构原理及应用; </p> <p> 3)看不懂大牛代码设计思想的人,因为所有的程序设计底层逻辑都是数学; </p> <p> 4)想学习新技术,如:人工智能、机器学习、深度学习等,这门课程是你的必修课程; </p> <p> 5)想修炼更好的编程内功,在遇到问题时可以灵活的应用数学思维解决问题。 </p> <p> <br> </p> <p> 在这门「专为程序员设计的数学课」系列课中,我们保证你能收获到这些:<br> <br> <span> </span> </p> <p class="ql-long-24357476"> <span class="ql-author-24357476">①价值300元编程课程大礼包</span> </p> <p class="ql-long-24357476"> <span class="ql-author-24357476">②应用数学优化代码的实操方法</span> </p> <p class="ql-long-24357476"> <span class="ql-author-24357476">③数学理论在编程实战中的应用</span> </p> <p class="ql-long-24357476"> <span class="ql-author-24357476">④程序员必学的5大数学知识</span> </p> <p class="ql-long-24357476"> <span class="ql-author-24357476">⑤人工智能领域必修数学课</span> </p> <p> <br> 备注:此课程只讲程序员所需要的数学,即使你数学基础薄弱,也能听懂,只需要初中的数学知识就足矣。<br> <br> 如何听课? </p> <p> 1、登录CSDN学院 APP 在我的课程中进行学习; </p> <p> 2、登录CSDN学院官网。 </p> <p> <br> </p> <p> 购课后如何领取免费赠送的编程大礼包和加入答疑群? </p> <p> 购课后,添加助教微信:<span> csdnxy68</span>,按提示领取编程大礼包,或观看付费视频的第一节内容扫码进群答疑交流! </p> <p> <img src="https://img-bss.csdn.net/201912251155398753.jpg" alt=""> </p>


本套课程的设计完全是为初学者量身打造,课程内容由浅入深,课程讲解通俗易懂,代码实现简洁清晰。通过本课程的学习,学员能够入门微信公众平台开发,能够胜任企业级的订阅号、服务号、企业号的应用开发工作。 通过本课程的学习,学员能够对微信公众平台有一个清晰的、系统性的认识。例如,公众号是什么,它有什么特点,它能做什么,怎么开发公众号。 其次,通过本课程的学习,学员能够掌握微信公众平台开发的方法、技术和应用实现。例如,开发者文档怎么看,开发环境怎么搭建,基本的消息交互如何实现,常用的方法技巧有哪些,真实应用怎么开发。


这是一个门针对零基础学员学习微信小程序开发的视频教学课程。课程采用腾讯官方文档作为教程的唯一技术资料来源。杜绝网络上质量良莠不齐的资料给学员学习带来的障碍。 视频课程按照开发工具的下载、安装、使用、程序结构、视图层、逻辑层、微信小程序等几个部分组织课程,详细讲解整个小程序的开发过程


文章目录Java概述何为编程什么是Javajdk1.5之后的三大版本JVM、JRE和JDK的关系什么是跨平台性?原理是什么Java语言有哪些特点什么是字节码?采用字节码的最大好处是什么什么是Java程序的主类?应用程序和小程序的主类有何不同?Java应用程序与小程序之间有那些差别?Java和C++的区别Oracle JDK 和 OpenJDK 的对比基础语法数据类型Java有哪些数据类型switc...








这门课程基于主流的java8平台,由浅入深的详细讲解了java SE的开发技术,可以使java方向的入门学员,快速扎实的掌握java开发技术!

【数据结构与算法综合实验】欢乐连连看(C++ & MFC)案例

这是武汉理工大学计算机学院数据结构与算法综合实验课程的第三次项目:欢乐连连看(C++ & MFC)迭代开发代码。运行环境:VS2017。已经实现功能:开始游戏、消子、判断胜负、提示、重排、计时、帮助。


第十六届“华为杯”数学建模竞赛D题“汽车行驶工况构建”论文。论文获得比赛国家二等奖,论文为原创,仅供参考。 关键词:数据处理;降维;聚类。

Vue.js 2.0之全家桶系列视频课程

基于新的Vue.js 2.3版本, 目前新全的Vue.js教学视频,让你少走弯路,直达技术前沿! 1. 包含Vue.js全家桶(vue.js、vue-router、axios、vuex、vue-cli、webpack、ElementUI等) 2. 采用笔记+代码案例的形式讲解,通俗易懂


Android平台音视频开发全套,涉及:FFmpeg软解码解码、Mediacodec硬解码编码、Openssl音频播放、OpenGL ES视频渲染、RTMP推流等核心重要知识点。


课程亮点: 课程培训详细的笔记以及实例代码,让学员开始掌握设计模式知识点 课程内容: 工厂模式、桥接模式、组合模式、装饰器模式、外观模式、享元模式、原型模型、代理模式、单例模式、适配器模式 策略模式、模板方法模式、观察者模式、迭代器模式、责任链模式、命令模式、备忘录模式、状态模式、访问者模式 课程特色: 笔记设计模式,用笔记串连所有知识点,让学员从一点一滴积累,学习过程无压力 笔记标题采用关键字标识法,帮助学员更加容易记住知识点 笔记以超链接形式让知识点关联起来,形式知识体系 采用先概念后实例再应用方式,知识点深入浅出 提供授课内容笔记作为课后复习以及工作备查工具 部分图表(电脑PC端查看):


想学好JAVA必须要报两万的培训班吗? Java大神勿入 如果你: 零基础想学JAVA却不知道从何入手 看了一堆书和视频却还是连JAVA的环境都搭建不起来 囊中羞涩面对两万起的JAVA培训班不忍直视 在职没有每天大块的时间专门学习JAVA 那么恭喜你找到组织了,在这里有: 1. 一群志同道合立志学好JAVA的同学一起学习讨论JAVA 2. 灵活机动的学习时间完成特定学习任务+每日编程实战练习 3. 热心助人的助教和讲师及时帮你解决问题,不按时完成作业小心助教老师的家访哦 上一张图看看前辈的感悟: &nbsp; &nbsp; 大家一定迫不及待想知道什么是极简JAVA学习营了吧,下面就来给大家说道说道: 什么是极简JAVA学习营? 1. 针对Java小白或者初级Java学习者; 2. 利用9天时间,每天1个小时时间; 3.通过 每日作业 / 组队PK / 助教答疑 / 实战编程 / 项目答辩 / 社群讨论 / 趣味知识抢答等方式让学员爱上学习编程 , 最终实现能独立开发一个基于控制台的‘库存管理系统’ 的学习模式 极简JAVA学习营是怎么学习的? &nbsp; 如何报名? 只要购买了极简JAVA一:JAVA入门就算报名成功! &nbsp;本期为第四期极简JAVA学习营,我们来看看往期学员的学习状态: 作业看这里~ &nbsp; 助教的作业报告是不是很专业 不交作业打屁屁 助教答疑是不是很用心 &nbsp; 有奖抢答大家玩的很嗨啊 &nbsp; &nbsp; 项目答辩终于开始啦 &nbsp; 优秀者的获奖感言 &nbsp; 这是答辩项目的效果 &nbsp; &nbsp; 这么细致的服务,这么好的氛围,这样的学习效果,需要多少钱呢? 不要1999,不要199,不要99,只要9.9 是的你没听错,只要9.9以上所有就都属于你了 如果你: 1、&nbsp;想学JAVA没有基础 2、&nbsp;想学JAVA没有整块的时间 3、&nbsp;想学JAVA没有足够的预算 还等什么?赶紧报名吧,抓紧抢位,本期只招300人,错过只有等时间待定的下一期了 &nbsp; 报名请加小助手微信:eduxy-1 &nbsp; &nbsp;

2019 AI开发者大会

2019 AI开发者大会(AI ProCon 2019)是由中国IT社区CSDN主办的AI技术与产业年度盛会。多年经验淬炼,如今蓄势待发:2019年9月6-7日,大会将有近百位中美顶尖AI专家、知名企业代表以及千余名AI开发者齐聚北京,进行技术解读和产业论证。我们不空谈口号,只谈技术,诚挚邀请AI业内人士一起共铸人工智能新篇章!


分享思维,改变世界. web网页制作,期末大作业. 所用技术:html css javascript 分享所学所得


【超实用课程内容】 本课程演示的是一套基于Java的SSM框架实现的图书管理系统,主要针对计算机相关专业的正在做毕设的学生与需要项目实战练习的java人群。详细介绍了图书管理系统的实现,包括:环境搭建、系统业务、技术实现、项目运行、功能演示、系统扩展等,以通俗易懂的方式,手把手的带你从零开始运行本套图书管理系统,该项目附带全部源码可作为毕设使用。 【课程如何观看?】 PC端:https://edu.csdn.net/course/detail/27513 移动端:CSDN 学院APP(注意不是CSDN APP哦) 本课程为录播课,课程2年有效观看时长,大家可以抓紧时间学习后一起讨论哦~ 【学员专享增值服务】 源码开放 课件、课程案例代码完全开放给你,你可以根据所学知识,自行修改、优化 下载方式:电脑登录https://edu.csdn.net/course/detail/27513,点击右下方课程资料、代码、课件等打包下载



2019 Python开发者日-培训



C++语言基础视频培训课程:本课与主讲者在大学开出的程序设计课程直接对接,准确把握知识点,注重教学视频与实践体系的结合,帮助初学者有效学习。本教程详细介绍C++语言中的封装、数据隐藏、继承、多态的实现等入门知识;主要包括类的声明、对象定义、构造函数和析构函数、运算符重载、继承和派生、多态性实现等。 课程需要有C语言程序设计的基础(可以利用本人开出的《C语言与程序设计》系列课学习)。学习者能够通过实践的方式,学会利用C++语言解决问题,具备进一步学习利用C++开发应用程序的基础。


本课程从初学者角度出发,提供了C#从入门到成为程序开发高手所需要掌握的各方面知识和技术。 【课程特点】 1 由浅入深,编排合理; 2 视频讲解,精彩详尽; 3 丰富实例,轻松易学; 4 每章总结配有难点解析文档。 15大章节,228课时,1756分钟与你一同进步!


编程实现学生基本信息管理程序。学生基本信息包括:学号、姓名、性别、年龄、班级、学院、专业等。具体实现的管理功能如下: (1) 输入并显示多个学生的基本信息; (2) 可根据需要实现学生信息的添加; (

android 漂亮的UI界面 完整的界面设计

声明:这也是我学习时在网上下载的,鉴于分享精神,并且觉得很不错才上传上来的。。。。。 android 漂亮的UI界面 完整的界面设计 这是一个完整的UI设计,但是没写动作,这是一个公司程序员的公司任务


Anacond的介绍 Anaconda指的是一个开源的Python发行版本,其包含了conda、Python等180多个科学包及其依赖项。 因为包含了大量的科学包,Anaconda 的下载文件比较大(约 531 MB),如果只需要某些包,或者需要节省带宽或存储空间,也可以使用Miniconda这个较小的发行版(仅包含conda和 Python)。 Conda是一个开源的包、环境管理器,可以用于...


DirectX修复工具(DirectX Repair)是一款系统级工具软件,简便易用。本程序为绿色版,无需安装,可直接运行。 本程序的主要功能是检测当前系统的DirectX状态,如果发现异常则进行修复

相关热词 c# 按行txt c#怎么扫条形码 c#打包html c# 实现刷新数据 c# 两个自定义控件重叠 c#浮点类型计算 c#.net 中文乱码 c# 时间排序 c# 必备书籍 c#异步网络通信