Disable a row based on condition from database in Liferay Search Container -


i have disable row retrieve database using liferay search container. have conditions stored in database.

what wish achieve this:

  1. i displaying list of students attendance need marked.
  2. sometimes students may take leave in advance in case attendance pre-marked in database.
  3. so when form marking attendance displayed, want disable marking attendance disabling row containing data of student attendance marked.

what want is, if attendance pre-marked, show row on form pre-marked attendance , not allow user mark attendance student i.e. disable row.

how can achieve this?

edited: code snippet

    mark attendance today:        <%=new java.util.date()%>      <portlet:actionurl name="updateatt" var="updateatturl" />          <aui:form name="updateatt" action="<%=updateatturl.tostring() %>" method="post" >              choose date 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 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> 

you can use conditional statements show label instead of input control or disabled input control, follows:

<% 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();  // can define flag pre-marked attendance boolean premarkflag = isstudentpremarked(); // have value true (student premarked) or false (if student 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> 

or way show label , not show input radio-button @ all

<liferay-ui:search-container-column-text name="attendance status">     <%     // assuming if premarkflag true student absent     // mentioned in 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>         

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -