1. Set as input box, enter and modify in the list
Set a onchange event for TimeLimit
' Columns ' =>array (' id ', array (' name ' = = ' platform ', ' value ' = ' $data->platform '), Array (' Name ' = = ' version ', ' value ' = ' $data->version '), Array (' name ' = = ' build ', ' value ' = ' $data Build '), Array (' name ' = = ' uptime ', ' value ' = ' $data->uptime '), Array (' name ' = ' = ' timelimit ', ' type ' = > ' raw ',//Input box ' value ' = ' Chtml::textfield ' ("TimeLimit", $data->timelimit,array ("size" = 25,//border-sized " Class "=" Txt_timelimit ",//Set style" id " =" $data->id ",//Current Data ID" onchange "+" Checkedfield ( This.value, $data->id,1) ",)))
Upload data to the background for updates
Update function Checkedfield (val,id,flag) {Updateapp (id,val,flag);}
function Updateapp (id,val,flag) {if (Confirm ("Confirm modification? ") {$.ajax ({url: ' Updateapp ', type: ' POST ', data:{" id ": ID," val ": Val," flag ": Flag},datatype: ' JSON ', success:function ( JSON) {//successfully obtained is also a JSON object if (json.flag) {alert ("modified successfully") $ (this). Val (json.val); Window.location.reload ();}})}}
Ii. operation of a checkbox
Add the following code under columns
Array (' name ' = ' isblock ', ' type ' = ' raw ',//Input box ' value ' = ' Chtml::checkbox ' ("Isblock", $data->isblock, Array ("id" = "$data->id",//Current Data id "value" = "$data->isblock", "onchange" = " check_ Isblock (this.checked, $data->id,3) ",)),
Set the default selected check box with JS
CheckBox Default Check Event $ (document). Ready (function () {var checkboxs = document.getelementsbyname ("Isblock"); for (Var i=0;i
Finally, the data is uploaded to the backstage
function Check_isblock (ischeck,id,flag) {var val = ischeck? ' Y ': ' N ';//updateapp (Id,val,flag);}
The above describes the Yii Ajax update data, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.