EasyUI Forum
December 05, 2025, 06:02:39 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: [SOLVED] GetRows specific column  (Read 12910 times)
finzaiko
Newbie
*
Posts: 44


View Profile
« on: March 31, 2016, 08:37:12 PM »

Hi,
I still couldn't find the solution to get selected column like below :
var rows = $('#dgProformaInv').datagrid('getRows');
this rows return all datagrid content (all column of object as (id, name, address)
but I just want specified column (name,address)

Thanks any help.
« Last Edit: April 01, 2016, 12:16:15 AM by finzaiko » Logged
devnull
Sr. Member
****
Posts: 431


View Profile
« Reply #1 on: March 31, 2016, 10:00:35 PM »

I have not tested this, but how about:

Code:
  var rows = $('#dgProformaInv').datagrid('getRows').filter(row){
    return {name:row.name,address:row.address};
  })
Logged

-- Licensed User --
finzaiko
Newbie
*
Posts: 44


View Profile
« Reply #2 on: March 31, 2016, 11:14:39 PM »

Still got an error, what is correct syntax using filter(row) ?
Logged
devnull
Sr. Member
****
Posts: 431


View Profile
« Reply #3 on: April 01, 2016, 12:04:12 AM »

Sorry, it appears that filter -> return returns the whole row, use map() instead:

Code:
    var rows = []; dg.datagrid('getRows').map(function(row){
     rows.push({name:row.name,address:row.address});
    })

I hijacked someone else's fiddle: http://jsfiddle.net/FFTQr/8/
« Last Edit: April 01, 2016, 12:08:39 AM by devnull » Logged

-- Licensed User --
finzaiko
Newbie
*
Posts: 44


View Profile
« Reply #4 on: April 01, 2016, 12:14:20 AM »

Thanks a lot devnull, Its work Smiley
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!