EasyUI Forum
September 14, 2025, 01:06:40 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Deleting rows in a grid with multiple IDs  (Read 9087 times)
jherrera
Newbie
*
Posts: 7


View Profile
« on: July 24, 2013, 04:46:27 AM »

Hi,

I've some grids where I have more than one ID field. For example, one of my grids has a column called order_id and another one called order_item_id (both fields are part of the PK of my order_items table in the backend). The values for those two columns must be sent to the server when I want to delete a row but, in the standard grid definition, I can only use one field as "idField".

Which is the best way to handle row deletions on tables where there's more than one idField?

Thanks in advance.
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: July 24, 2013, 07:53:27 AM »

Get a specified row and you will be able to post any fields to server. The code below shows how to delete the selected row.
Code:
var row = $('#dg').datagrid('getSelected');
if (row){
$.post(url, {
order_id: row.order_id,
order_item_id: row.order_item_id
}, function(){
$('#dg').datagrid('reload');
});
}
Logged
jherrera
Newbie
*
Posts: 7


View Profile
« Reply #2 on: July 25, 2013, 07:25:24 AM »

Thanks! It worked like a charm.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!