In ASP.Net, we can make the GridView edit/update or delete a row, and insert (using footer). Can I do something similar in Yii2, instead of creating one record at a time in a new page?
How to insert/edit records in Yii2 GridView, similar to ASP.Net
1.5k Views Asked by Shahid Thaika At
2
There are 2 best solutions below
2
Ankush Rishi
On
In Yii2 GridView there is an action grid column as Shown:
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\CheckboxColumn'],
['class' => 'yii\grid\SerialColumn'],
'id',
'name',
'price',
'image',
'area',
// 'address',
['class' => 'yii\grid\ActionColumn'],
],
]); ?>
Just place the last line ['class' => 'yii\grid\ActionColumn'], in your gridview.
Related Questions in GRIDVIEW
- change selected gridview cell background in android?
- How to create Gridview click menu in fragment?
- Grid view not displaying Image
- Grid onScroll not being called while scrolling
- set auto grid slide in jquery.gridnav.js
- Getting selectedrow in RowCommand
- Saving only the first row of a gridview to DB
- Linearlayout into cell of gridview
- how to filter a gridview from a stored procedure with a drop down list?
- Add paging buttons to gridview pagersetting set to Numeric
- ASP GridView Calculated column
- Adding image to GridView created in CodeBehind
- nothing happened when i click download button in gridview asp.net
- How to update Label value in Gridview coulmn one by one after completing first count of loop
- Check if gridview row is selected or not with javascript
Related Questions in ACTIVERECORD
- Ruby destroy is not working? Or objects still present?
- Select results where joined table contains records with an attribute, but without another
- ActiveRecord, Rails 4: has_many :through with scoped conditions failure
- Building a simple calculator form in Rails 4
- activerecord not like query
- How to get all users that have each of these tags?
- Can ActiveRecord sub classes be used to hold data from other sources such as Facebook too?
- Multiple belongs_to joins to the same table (In Rails 4.2 did the ability to do this in a clean way change?)
- Updating attributes from check_box
- Better practice for huge size of table on Ruby on Rails 4 / ActiveRecord
- return custom query as an activerecord relation
- Rails 4 fake ActiveRecord property based on association
- Order By count(*) from other table in yii 2
- Aliasing calculation result, grouping, and summing in ActiveRecord query using Postgres
- Can not update php activerecord: model is read-only
Related Questions in INSERT
- Cell comparison and row inserts
- Insert element into nested array in Mongodb
- If numeric then Insert numeric else Insert non-numeric
- Bulk insert performance in MongoDB for large collections
- insert data from 3 tables with the same fields into 1 table
- How to insert N rows of default values into a table
- SQLite INSERT with SELECT
- Postgres INSERT from Source (2 columns) into Target (3 columns)
- check if database row is empty
- Form data not inserting in Wordpress database even though hard coded data gets inserted
- Inserting data into mysql DB with cakePHP
- oracle insert into column using subquery
- Android database store same name in database issue
- How to insert/edit records in Yii2 GridView, similar to ASP.Net
- Stored Procedure not giving expected results in Insert query
Related Questions in YII2
- How to profile a Yii2 based API?
- Callback for Yii2's GridView CheckboxColumn
- yii 2 pagination is losing filter data in the model
- How to update/insert array of values to database using Yii2 ( many values for one id that repeats )
- Using static method that include once and initialize an object in Yii2
- Data is not getting from model - Yii2
- how to run yii form validation before my js file
- Order By count(*) from other table in yii 2
- Automagically logout user after session expires
- how to unhidden field base on the field validation in yii2
- MongoDB on Amazon EC2 - Configuring Mongo Client for Php
- yii2 - Why use yii\helpers\Html instead of just typing
- Yii2 creating global dynamic values for all application's actions
- same login for different subdomain in YII2
- Yii2 column in GridView is not displaying (not set)
Related Questions in EDIT
- Grabbing Edits from two strings
- Is it possible to edit a php file from itself?
- How to insert/edit records in Yii2 GridView, similar to ASP.Net
- Editing python scripts on-line?
- Basic CakePHP: Edit Post Method become Add Post Method
- Kendo Grid Popup Edit mode not displaying ComboBox data
- How to edit a UICollectionView item in another UIViewController?
- can't get to bash_profile file to edit the path on mac
- Designing an algorithm to calculate the edit distance between two strings
- How to edit a Class in Wordpress?
- Avoid EF update the null image to database in .Net MVC
- Edit line a textfile using linux shell
- Embedding SVG edit as a inline editor
- Rally: customize rally grid task board
- Ext.grid.Panel edits are ignored
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
The gridview provided by default does not allow this behavior. For this type of features you can use Extensions as Tabular From
These extension are easily configurable and free