performance - Adding button to controlgroup dynamically on every list item takes too long jquery mobile -


i quite new jquery mobile might trivial question. fact documentation not centralized jquery mobile making me post on stackoverflow.

currently, trying load listview , every item of listview has following structure. options button controlgroup button variable number of buttons below it, again received json.

currently there 250 objects , obtained server on 85 kb json. due dynamic nature of content caching data bit tricky.

i running problem wherein taking 15 seconds load page. find out reason causing added timestamp values within loops create list items dynamically.

interestingly main bottleneck - upto 12 out of 14 seconds taken while creating html controlgroup.

here image of options button give idea html

i keen know why rendering dynamic control groups on list items causing delay. not know how cache controlgroup since, grouped buttons dynamic , received json.

enter image description here

<enter image description here

i forward feedback on this,

thanks rajat

edit code snippet added. use routine generate every list item

foreach ($jsonarray $item) {

show adapter

echo '<li>'; if($item['reactioncount'] > 0) {     echo ' <a href="/planner/reactionbox/id:'. $item['jobid'] . '">';     if(isset($item['requiresaction'])) {         echo ' <span class="ui-li-count redbubble" style="background:#088a08"> </span>';     } else {          echo ' <span class="ui-li-count redbubble" style="background:#6e6e6e"> </span>';     } } else {     echo ' <a href="/planner/job-details/id:'. $item['jobid'] .'" name=\"job' . $item['jobid'] . '\">'; }  echo '<img style="float:left; padding: 11px 0px 0px 11px; width: 66px; vertical-align:middle;"          src="' . (($item['imageurl'] != '') ? $item['imageurl'] : '/img/website/profilephotodummy.png') . '" alt="dummyphoto" />         <h3>' . $item['firstline'] . '</h3>         <p><strong>' . $item['secondline'] . '</strong></p>         <p>' . $item['thirdline'] . '</p>         <p class="ui-li-aside"><strong>' . $item['optionalline'] . '</strong></p>         </a>';  if(isset($item['actions'])) {     echo '<div data-role="controlgroup" data-type="horizontal" style="margin-left: 15px;" data-mini="true">     <select data-native-menu="false" data-theme="b" data-inline="true" data-mini="true" data-icon="gear" onchange="dojobaction(\'' . $currenturl . '/\'+this.value); this.selectedindex=0;">     <option>' . __d('website','opties',true) . '';      foreach ($item['actions'] $value) {          # every action json generate action button dynamically ...         if($value == 'annuleer_opdracht') {              echo '<option value=" ' . $currenturl . '/canceljob:' . $flexbox['jobid'] . ' ">annuleer</option>';          } else if($value == 'zoek_opnieuw') {              echo '<option value="' . $currenturl . '/newsearchjob:' . $flexbox['jobid'] . '">zoek opnieuw</option>';          } else if($value == 'publiceer_externe') {                                                              echo '<option value="' . $currenturl . '/openforfreelancer:' . $flexbox['jobid'] . '">publiceer externe</option>';          }     }     echo '</option></select></div>'; } echo '</li>'; }  


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -