EasyUI Forum
May 13, 2024, 08:59:07 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: pivot grid extension  (Read 8888 times)
Opan Mustopah
Full Member
***
Posts: 164


Indonesia


View Profile Email
« on: May 10, 2015, 07:37:57 PM »

hello again,

want to ask about pivot gird extension, btw its great plugin.

after seeing and try pivot grid demo, i see, value on pivot grid is only support for number value, but not string value,

is it possible to use string as value on pivot grid? because when i try to mov field that contain string value to 'value' panel, all value become 0 (zero)

thanks in adnvance
Logged

-- Bajak Otak --
*** Sorry for my bad english :3 ***
--JeasyUI version 1.4--
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: May 11, 2015, 08:13:43 AM »

You have to use numeric for value fields because they will be calculated.
Logged
Opan Mustopah
Full Member
***
Posts: 164


Indonesia


View Profile Email
« Reply #2 on: May 11, 2015, 08:01:15 PM »

thanks stworthy for your answer.
but,

is there a way to using like formatter properties on datagrid, so i can do something like bind the value with another value contains string?
because i really need this plugin to support that feature.

thanks in advance
Logged

-- Bajak Otak --
*** Sorry for my bad english :3 ***
--JeasyUI version 1.4--
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #3 on: May 11, 2015, 08:13:45 PM »

The default operator on the value fields is 'sum'. You can try to extend other operators to fit your requirement. For more information please refer to http://www.jeasyui.com/extension/pivotgrid.php.
Code:
//implement the 'sum' operator
$.extend($.fn.pivotgrid.defaults.operators, {
sum: function(rows, field){
var opts = $(this).pivotgrid('options');
var v = 0;
$.map(rows,function(row){
v += parseFloat(row[field])||0;
});
return v.toFixed(opts.valuePrecision);
}
});
Logged
Opan Mustopah
Full Member
***
Posts: 164


Indonesia


View Profile Email
« Reply #4 on: May 11, 2015, 08:51:48 PM »

thanks stworthy for your fast response,
i'll try it and i'll report it to you if its works or not.

Logged

-- Bajak Otak --
*** Sorry for my bad english :3 ***
--JeasyUI version 1.4--
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!