javascript reorderOrder_004.js

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了javascript reorderOrder_004.js相关的知识,希望对你有一定的参考价值。

function resetOrder(catID,iteration) {

	/*Grab all variables on a Catalog Item/Record Producer and reset the order value by the iteration
	* catID: string [catalog item sys_id]
	* iteration: int [5, 10, 100]
	*/

	var a = [];
	var b = [];
	var n = 0;
	var x = 0;

	var gr = new GlideRecord('item_option_new');
	gr.addEncodedQuery('cat_item='+catID);
	gr.orderBy('order');
	gr.query();
	while(gr.next()) {
		a.push({
			sys_id:gr.getUniqueValue(),
			oldOrder:gr.getDisplayValue('order')
		});
		n++;
		x = n*iteration;
		b.push(x);
	}

	for(var i=0;i<a.length;i++) {
		a[i].newOrder = b[i];
		var v = new GlideRecord('item_option_new');
		v.get(a[i].sys_id);
		v.order = b[i];
		v.update();
	}

}

//resetOrder('02c78de49f331200d9011977677fcf76',100);

以上是关于javascript reorderOrder_004.js的主要内容,如果未能解决你的问题,请参考以下文章

javascript reorderOrder_002.js

javascript reorderOrder_001.js

JavaScript 进制转换

Vue.js 在组件中使用本地 javascript 文件函数:Uncaught TypeError: __WEBPACK_IMPORTED_MODULE_0__.writeSomething is

JavaScript常用工具类

JavaScript常用工具类