gpt4 book ai didi

liferay - 根据 Liferay 搜索容器中数据库的条件禁用行

转载 作者:行者123 更新时间:2023-11-28 02:15:03 27 4
gpt4 key购买 nike

我必须禁用使用 Liferay 搜索容器从数据库检索的行。我在数据库中存储了某些条件。

我希望实现的是:

  1. 我正在显示需要标记出勤率的学生列表。
  2. 有时,学生可能会提前休假,在这种情况下,出勤情况会在数据库中预先标记。
  3. 因此,当显示出勤表时,我想通过禁用包含已标记出勤的学生数据的行来禁用出勤标记。

我想要做的是,如果出勤已预先标记,则在表单上显示预先标记出勤的行,并且不允许用户为该学生标记出勤,即禁用该行。

我怎样才能实现这个目标?

编辑:代码片段

    Mark Attendance for Today:   
<%=new java.util.Date()%>

<portlet:actionURL name="updateAtt" var="updateAttURL" />

<aui:form name="updateAtt" action="<%=updateAttURL.toString() %>" method="post" >

Choose Date to mark Attendance:
<liferay-ui:input-date formName="attendanceDate" yearRangeStart="<%=year %>" yearRangeEnd="<%=year %>"
yearValue="<%=year %>" monthValue="<%=month %>" dayValue="<%=day %>"
dayParam="datt" monthParam="matt" yearParam="yatt" />

<portlet:renderURL var="viewstudentDataURL"/>

<liferay-ui:search-container delta="20" emptyResultsMessage="No Results Found">

<liferay-ui:search-container-results total="<%= studentAttendanceDetails .size() %>"
results="<%= ListUtil.subList(studentAttendanceDetails , searchContainer.getStart(), searchContainer.getEnd()) %>" />
<liferay-ui:search-container-row modelVar="search"
className="com.corpserver.mis.portal.model.Student">

<%
String LImageId = String.valueOf(search.getFileEntryId());
long ImageId = Long.valueOf(LImageId);
DLFileEntry image = DLFileEntryLocalServiceUtil .getFileEntry(ImageId );
String imageURL = "/documents/" + image.getGroupId() + "/" + image.getFolderId() + "/" + image.getTitle()+"/"+image.getUuid();
%>

<liferay-ui:search-container-column-text name="student Photo" href = "">
<img src="<%=imageURL%>" height="50" width="50"/>
</liferay-ui:search-container-column-text>
<!-- Code to display student Image -->

<%
String eol = System.getProperty("line.separator");
%>

<liferay-ui:search-container-column-text name='student Name' value='<%=String.valueOf(search.getstudentFname()) + String.valueOf(search.getstudentLname()) + "<br>" + String.valueOf(search.getstudentTitle()) %>' href="" >

</liferay-ui:search-container-column-text>

<liferay-ui:search-container-column-text name="Attendance Status">
<label>Present</label><input type = "radio" name ='updateattendance<%=String.valueOf(search.getstudentId())%>' value = "Present" />
<label>Absent</label><input type = "radio" name= 'updateattendance<%=String.valueOf(search.getstudentId())%>' value = "Absent"/>
</liferay-ui:search-container-column-text>

</liferay-ui:search-container-row>

<liferay-ui:search-iterator searchContainer="<%=searchContainer %>" paginate="<%=true %>" />
</liferay-ui:search-container>

<input type = "submit" value = "Update"/>
</aui:form>
</body>
</html>

最佳答案

您可以使用条件语句仅显示标签而不显示输入控件或禁用输入控件,如下所示:

<%
String LImageId = String.valueOf(search.getFileEntryId());
long ImageId = Long.valueOf(LImageId);
DLFileEntry image = DLFileEntryLocalServiceUtil .getFileEntry(ImageId );
String imageURL = "/documents/" + image.getGroupId() + "/" + image.getFolderId() + "/" + image.getTitle()+"/"+image.getUuid();

// you can define a flag for the pre-marked attendance
boolean preMarkFlag = isStudentPreMarked(); // have value true (student is premarked) or false (if the student is not pre-maked)
%>

<liferay-ui:search-container-column-text name="Attendance Status">
<label>Present</label>
<input type = "radio"
name ='updateattendance<%=String.valueOf(search.getstudentId())%>'
value = "Present"
<%= preMarkFlag ? "disabled" : "" %> />

<label>Absent</label>
<input type = "radio"
name ='updateattendance<%=String.valueOf(search.getstudentId())%>'
value = "Absent"
<%= preMarkFlag ? "disabled" : "" %> />
</liferay-ui:search-container-column-text>

或者另一种方法是只显示标签而不显示输入单选按钮

<liferay-ui:search-container-column-text name="Attendance Status">
<%
// I am assuming if preMarkFlag is true then the student is absent
// as mentioned in your question
if (preMarkFlag) {
%>

<label>Absent</label>

<%
} else {
%>

<label>Present</label>
<input type = "radio"
name ='updateattendance<%=String.valueOf(search.getstudentId())%>'
value = "Present"
<%= preMarkFlag ? "disabled" : "" %> />

<label>Absent</label>
<input type = "radio"
name ='updateattendance<%=String.valueOf(search.getstudentId())%>'
value = "Absent"
<%= preMarkFlag ? "disabled" : "" %> />

<%
}
%>
</liferay-ui:search-container-column-text>

关于liferay - 根据 Liferay 搜索容器中数据库的条件禁用行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16516415/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com