Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/392.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/85.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何向JsGrid自定义sortStrategies函数传递其他参数?_Javascript_Jquery_Javascript Objects_Jsgrid - Fatal编程技术网

Javascript 如何向JsGrid自定义sortStrategies函数传递其他参数?

Javascript 如何向JsGrid自定义sortStrategies函数传递其他参数?,javascript,jquery,javascript-objects,jsgrid,Javascript,Jquery,Javascript Objects,Jsgrid,我使用的是JsGrid v1.5.3,我使用JsGrid成功地创建了这样一个字段 { name: "1_price", className: 'wordwrap', title: 'Test Price', type: "text", width: 75, filtering: false, sorting: true, sorter: 'priceSorter', itemTempl

我使用的是JsGrid v1.5.3,我使用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>';
        }
    }
} 
console.log(arguments)
它只发送2个参数值,如何扩展它以便接收其他参数,例如,其他参数是字段名(1_price):


通过在数组或JSON对象中定义多个参数,可以发送多个参数

window.jsGrid.sortStrategies.priceSorter = function({price1:price1, price2:price2, fieldName:fieldName}) {
   console.log(arguments)
}


通过在数组或JSON对象中定义多个参数,可以发送多个参数

window.jsGrid.sortStrategies.priceSorter = function({price1:price1, price2:price2, fieldName:fieldName}) {
   console.log(arguments)
}

window.jsGrid.sortStrategies.priceSorter = function({price1:price1, price2:price2, fieldName:fieldName}) {
   console.log(arguments)
}
var params = {price1:price1, price2:price2, fieldName:fieldName};
window.jsGrid.sortStrategies.priceSorter = function(params) {
   console.log(arguments)
}
var params = [price1, price2, fieldName];
window.jsGrid.sortStrategies.priceSorter = function(params) {
   console.log(arguments)
}