Forum


05:57

03/11/2008

Hi all
Ex:
{edit:true,add:false,del:true,search:false,refresh:true},
{ height:280,
editCaption:”Edit”,
bSubmit:”Submit”,
bCancel:”Cancel”,
url:”", //how to use?
processData:”Loading..”,
reloadAfterSubmit:false
},
//{reloadAfterSubmit:false},//add
{
msg:”Delete selected row(s)”,
bSubmit:”Submit”,
bCancel:”Cancel”,
url:”",
reloadAfterSubmit:false
} // del options
);
I want to del(edit) row(s)
I dont know use url to del a row.
Pls help me.
08:39

Moderators
30/10/2007

Hello,
Please read the docs.
Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
09:58

03/11/2008

Thanks Tony.
I read the docs but I don't understand.
{
msg:”Delete selected row(s)”,
bSubmit:”Submit”,
bCancel:”Cancel”,
url:””,
reloadAfterSubmit:false
} // del options
Pls help me Tony
08:08

03/11/2008

Thanks YamilBracho.
I want to delete a row(s). Ex :A row have id=10.How to GET or POST this id to delete (file php)
{
msg:”Delete selected row(s)”,
bSubmit:”Submit”,
bCancel:”Cancel”,
url:”pro.php?mode=del&id= ”+id,//HOW TO GET(POST) THIS ID SEND TO php file?
reloadAfterSubmit:false
} // del options
09:05

08/09/2008

It is not needed to add the "mode" to your url because jqGrid does for you and pass "del" in the "oper" variable.
You can add any kind of information to your delete url using the delData array. This the code for my delete option:
beforeSubmit: function() {
var sr = jQuery("#list").getGridParam('selrow');
var rowData = jQuery("#list").getRowData(sr);
this.delData = {"co_sector" : rowData['co_sector']};
retarr = {"co_sector" : rowData['co_sector']};
return retarr;
}
}
I am adding the "co_sector" information to my url so it will receive oper=del&co_sector=10, for example...
HTH and it doesn't just ask again...
11:02

03/11/2008

Thanks.
My code here
<script type="text/javascript">
jQuery("#s1list").jqGrid({
url:'seek.php?q=1',
datatype: "json",
colNames:['STT','Tên thuốc', 'ÄÆ¡n giá','Số lượng','Thành tiá»n','Liá»u dùng'],
colModel:[
{name:'ct_id',index:'ct_id', width:50,editable:true,editoptions:{readonly:true,size:10}},
//{name:'catId',index:'catId', width:190, align:"left",edittype:'select',editoptions:{value:":All;18:Thuoc bo gan;19:test;20:Thuoc khang sinh"}},
{name:'title',index:'title', width:180,editable:true,editoptions:{readonly:true,size:10}},
{name:'price',index:'price', width:80,editable:true,editoptions:{readonly:true,size:10}},
{name:'c_qty',index:'c_qty', width:80, sortable:false,editable:true},
{name:'subtotal',index:'subtotal',width:150,editable:true,editoptions:{readonly:true,size:10},sortable:false},
{name:'lieudung',index:'lieudung',editable:true,width:300,sortable:false,edittype:"textarea", editoptions:{rows:"2",cols:"20"}}
],
rowNum:10,
mtype: "POST",
rowList:[10,20,30],
imgpath: gridimgpath,
pager: jQuery('#s1pager'),
sortname: 'ct_id',
viewrecords: true,
toolbar : [true,"top"],
sortorder: "desc",
caption:"Danh sách thuốc Ä‘ã chá»n"
});
jQuery("#t_s1list").height(25).hide().filterGrid("s1list",{gridModel:true,gridToolbar:true});
jQuery("#sg_invdate").datepicker({dateFormat:"yy-mm-dd"});
jQuery("#s1list").navGrid('#s1pager',
{edit:true,add:false,del:true,search:false,refresh:true},
{ height:280,
editCaption:"Sá»a đơn thuốc",
bSubmit:"Cáºp nháºt",
bCancel:"Há»§y bá»",
url:"edit_donthuoc.php?mode=addsm",
processData:"Äang chạy...",
reloadAfterSubmit:false
},
//{reloadAfterSubmit:false},//add
{
msg:”Delete selected row(s)”,
bSubmit:”Submit”,
bCancel:”Cancel”,
url:”pro.php?mode=del&id= ”+id,//HOW TO GET(POST) THIS ID SEND TO php file?
reloadAfterSubmit:false
} // del options
);
</script>
pro.php
<?php
include("./common.php");
$mode = isset($_GET["mode"]) ? htmlspecialchars($_GET["mode"]) : '';
switch ($mode)
{
case "edit":
do_edit_thuoc();
break;
case "del":
do_delete_thuoc();
break;
.......
}
function do_delete_thuoc(){
global $lang,$db, $template;
$ct_id = isset($_POST['ct_id']) ? intval($_POST['ct_id']) : 0;
$sql = 'DELETE FROM tblcart WHERE ct_id='.$ct_id;
if( !$db->sql_query($sql) ) {
message_die("Couldn't access to database!!!", "", __LINE__, __FILE__, $sql);
}
return true;
}
12:10

08/09/2008

So you have tow urls chained to this grid...
I think you can still use the code I show (beforeSubmit event).
In this method you could see :
var sr = jQuery(”#list”).getGridParam('selrow');
var rowData = jQuery(”#list”).getRowData(sr);
The first line take the current row selected and the second one get the data in this row. Now you can access any value in the row doing something like:
alert(rowData['id']);
Also there is a postData array that you can manipulta using the setPostData() and appendPostData() methods...
07:03

08/09/2008

It could be something like:
{
msg:”Delete selected row(s)”,
bSubmit:”Submit”,
bCancel:”Cancel”,
url:"pro.php?mode=del"
reloadAfterSubmit:false,
beforeSubmit: function() {
var sr = jQuery(”#list”).getGridParam('selrow');
var rowData = jQuery(”#list”).getRowData(sr);
this.delData = {”id” : rowData['id']};
retarr = {”id” : rowData['id']};
return retarr;
}
}
} // del options
HTH
20:51

22/12/2011

Hello, I has this function :
function borrar_cs(row_id,count_sheet)
{
var options = {
caption: "Cancel Count Sheet",
url: '../../countsheetbiz?accion=delete_count_sheet&cs='+count_sheet,
msg: "Cancel count sheet ["+count_sheet+"]?",
bSubmit: "YES",
bCancel: "NO ",
top:"150",
recreateForm:true,
left:"300"
};
$("#tab_list").jqGrid('delGridRow',row_id, options );
}
I invoke this function from a button in the jqgrid, my problem is the msg is not refreshing, somebody know how to refresh the msg on the delete window?
for example: the first time the msg is "Cancel count sheet [40]?" this is correct but the next time
the count_sheet variable change the value but the msg is the same,
the problem is only on the msg, on the code behind is correct, I receive the correct value
thank you in advance
Most Users Ever Online: 715
Currently Online:
55 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66