AnonSec Shell
Server IP : 85.193.89.191  /  Your IP : 18.118.120.128
Web Server : Apache
System : Linux 956367-cx40159.tmweb.ru 3.10.0-1160.105.1.el7.x86_64 #1 SMP Thu Dec 7 15:39:45 UTC 2023 x86_64
User : bitrix ( 600)
PHP Version : 8.1.27
Disable Function : NONE
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/bitrix/www/bitrix/js/sale/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/bitrix/www/bitrix/js/sale/core_ui_dynamiclist.js
(function(){

	if(typeof BX.ui != 'object')
		BX.ui = {};

	//////////////////////////////
	// generic dynamic list
	//////////////////////////////

	BX.ui.dynamicList = function(opts, nf){

		this.parentConstruct(BX.ui.dynamicList, opts);

		BX.merge(this, {
			opts: {
				initiallyAdd: 	0, // how many empty fields to show initially
				startFrom: 		0, // todo: make able to calculate this based on count of row already present
			},
			vars: {
				idOffset: 0
			},
			sys: {
				code: 'dynamiclist'
			}
		});

		this.handleInitStack(nf, BX.ui.dynamicList, opts);
	}
	BX.extend(BX.ui.dynamicList, BX.ui.widget);

	// the following functions can be overrided with inheritance
	BX.merge(BX.ui.dynamicList.prototype, {

		// member of stack of initializers, must be defined even if does nothing
		init: function(){

			BX.ui.dynamicList.superclass.init.call(this);

			this.ctrls.container = this.getControl('container');
			this.vars.idOffset = parseInt(this.opts.startFrom);

			this.pushFuncStack('buildUpDOM', BX.ui.dynamicList);
			this.pushFuncStack('bindEvents', BX.ui.dynamicList);
		},

		buildUpDOM: function(){
			var so = this.opts;

			for(var k = 0; k < parseInt(so.initiallyAdd); k++)
				this.addRow();
		},

		bindEvents: function(){

			var ctx = this,
				so = this.opts,
				sc = this.ctrls;

			var addMore = this.getControl('addmore', true);
			if(addMore != 'undefined'){
				BX.bind(addMore, 'click', function(){
					ctx.addRow();
				});
			}
		},

		addRow: function(){
			BX.append(this.whenbuildRow(), this.ctrls.container);
			this.vars.idOffset++;
		},

		whenbuildRow: function(){
			var row = this.createNodesByTemplate('row', {'column_id': this.vars.idOffset}, true)[0];

			this.fireEvent('after-row-built', [row]);

			return row;
		}
	});

})();

Anon7 - 2022
AnonSec Team