Module: SelectAction

Defined in:
lib/selectAction.rb,
lib/selectAction/version.rb

Constant Summary collapse

VERSION =
"0.1.4"

Class Method Summary collapse

Class Method Details

.getOptionHtml(pkId, primarySel, secondarySel, selectDetail) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/selectAction.rb', line 4

def self.getOptionHtml(pkId, primarySel, secondarySel, selectDetail)	
	@PSHtml = ''
	primarySel.find_each do |priItem|
		@PSHtml += '<option value="' + priItem.id.to_s
		if priItem.id.to_s == pkId
			@PSHtml += '" selected>'+ priItem[selectDetail["prDisp"]]
		else
			@PSHtml += '">'+ priItem[selectDetail["prDisp"]]
		end				
		@PSHtml += '</option>'
	end
	@SSHtml = '<option value="-1">Select</option>'
	secondarySel.find_each do |secItem|
		@SSHtml += '<option value="' + secItem.id.to_s
		@SSHtml += '">'+ secItem[selectDetail["secDisp"]]
		@SSHtml += '</option>'
	end
	@result = [@PSHtml,@SSHtml]
	return @result
end