I'm using JsGrid v1.5.3 and i successfully created a field like this using JsGrid
{
name: "1_price",
className: 'wordwrap',
title: 'Test Price',
type: "text",
width: 75,
filtering: false,
sorting: true,
sorter: 'priceSorter',
itemTemplate: function(value, item) {
if (typeof value === 'undefined') value = '';
if (item && item.hasOwnProperty('is_sold_out') && item.is_sold_out == 1) {
return '<span class="sold-out-strikethrough">' + value + '</span>';
} else {
return '<span>' + value + '</span>';
}
}
}
then i tried to create the custom sorter function like this:
window.jsGrid.sortStrategies.priceSorter = function(price1, price2) {
console.log(arguments)
}
from the console.log(arguments)
it only send 2 parameters value, how can i extend it so i can receive another parameters, for example the additional parameters is the field name (1_price):
window.jsGrid.sortStrategies.priceSorter = function(price1, price2, fieldName) {
console.log(arguments)
}
You can send multiple parameters by defining them in an Array or JSON object.
Or
Or