數據不是由克檢索:選擇Grails中3. 我的代碼是像如下─數據不是檢索由G:選擇Grails中3
<g:select from="${Machine_summaryList}" name="brand" />
這裏「Machine_summaryList」是「Machine_summary」的列表類和「品牌」是我需要檢索的數據列。
數據不是由克檢索:選擇Grails中3. 我的代碼是像如下─數據不是檢索由G:選擇Grails中3
<g:select from="${Machine_summaryList}" name="brand" />
這裏「Machine_summaryList」是「Machine_summary」的列表類和「品牌」是我需要檢索的數據列。
就在這個過程對我的作品
<g:select from="${project.Machine_summary.executeQuery("select distinct c.brand from Machine_summary c")}" name="brand" />
在這種情況下,您需要使用optionValue="brand"
。
你g:select
必須像:
<g:select from="${Machine_summaryList}" name="brand" optionKey="id" optionValue="brand"/>
當表單將提交,你會在params.brand
收到所選擇的機器。
我也使用過這一個,但它不工作,而我有Machine_summaryList中的數據,它通過使用「$ {Machine_summaryList}」拋出List.gsp中的數據,但它的不在g:select上工作 –
和問題是什麼? – injecteer
這裏所有的品牌名稱都應該選擇,但數據不能檢索 –
你怎麼知道? mayby你的清單是空的? – injecteer