Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
How to use url in jQuery("#grid_id").delGridRow( row_id_s, options );
17/11/2008
05:57
Avatar
adam
Member
Members
Forum Posts: 6
Member Since:
03/11/2008
sp_UserOfflineSmall Offline

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.

17/11/2008
08:39
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

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.

17/11/2008
09:58
Avatar
adam
Member
Members
Forum Posts: 6
Member Since:
03/11/2008
sp_UserOfflineSmall Offline

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

18/11/2008
07:23
Avatar
YamilBracho
Member
Members
Forum Posts: 124
Member Since:
08/09/2008
sp_UserOfflineSmall Offline

Which part is the difficult one ?

Give us more information to help you better...

18/11/2008
08:08
Avatar
adam
Member
Members
Forum Posts: 6
Member Since:
03/11/2008
sp_UserOfflineSmall Offline

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

18/11/2008
09:05
Avatar
YamilBracho
Member
Members
Forum Posts: 124
Member Since:
08/09/2008
sp_UserOfflineSmall Offline

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...

18/11/2008
11:02
Avatar
adam
Member
Members
Forum Posts: 6
Member Since:
03/11/2008
sp_UserOfflineSmall Offline

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;
}

18/11/2008
12:10
Avatar
YamilBracho
Member
Members
Forum Posts: 124
Member Since:
08/09/2008
sp_UserOfflineSmall Offline

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...

18/11/2008
14:24
Avatar
adam
Member
Members
Forum Posts: 6
Member Since:
03/11/2008
sp_UserOfflineSmall Offline

From  my scripts(js and php) .You can edit for me?.

I'm a newbie.Pls help me YamilBracho.The first time  i use jqgird

19/11/2008
07:03
Avatar
YamilBracho
Member
Members
Forum Posts: 124
Member Since:
08/09/2008
sp_UserOfflineSmall Offline

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

22/12/2011
20:51
Avatar
Felipe
Mexico
New Member
Members
Forum Posts: 2
Member Since:
22/12/2011
sp_UserOfflineSmall Offline

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

23/12/2011
03:00
Avatar
Felipe
Mexico
New Member
Members
Forum Posts: 2
Member Since:
22/12/2011
sp_UserOfflineSmall Offline

solved with this line

$(".delmsg").html(options.msg);

$("#tab_list").jqGrid('delGridRow',row_id, options );

Forum Timezone: Europe/Sofia

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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information