Changeset 6820


Ignore:
Timestamp:
27 Sep 2011, 08:25:04 (13 years ago)
Author:
Henrik Bettermann
Message:

Add a 'toggle all' Javascript function to klick all select boxes at the same time in in large forms. Use this function in the containermanagepage.pt.

jquery.dataTables.min.js: Allow viewing 1000 and even 5000 rows.

Location:
main/waeup.sirp/trunk/src/waeup/sirp
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/browser/resources.py

    r6064 r6820  
    114114#:   <input type="submit" name="xyz" value="abc"/>
    115115#:          onclick="return confirmPost('Are you sure?')">
    116 warning = ResourceInclusion(waeup_sirp, 'warning.js')       
     116warning = ResourceInclusion(waeup_sirp, 'warning.js')
     117
     118#: If you have many select boxes in a from which have to be selected at the same
     119# time you have to perform
     120#: two steps:
     121#: * In the `update()` method of the responsible view/page/form
     122#:   require the JavaScript code to be rendered into the page:
     123#:
     124#:     from waeup.sirp.browser.resources import toggleall
     125#:     ...
     126#:     class MyPage(...):
     127#:       ...
     128#:       def update(self):
     129#:         toggleall.need()
     130#:
     131#:   This way all required JavaScripts will be rendered correctly
     132#:   into the HTML page generated.
     133#:
     134#:   In your HTML code add some <input> tag with onClick event:
     135#:
     136#:   <input type="checkbox" onClick="toggle(this, 'entries')" />
     137
     138toggleall = ResourceInclusion(waeup_sirp, 'toggleall.js')
    117139
    118140#: A resource that binds jQueryUI tabs to <div> tags with class
  • main/waeup.sirp/trunk/src/waeup/sirp/browser/static/jquery.dataTables.min.js

    r6010 r6820  
    3838[];this.aoColumns=[];this.iNextId=0;this.asDataSearch=[];this.oPreviousSearch={sSearch:"",bRegex:false,bSmart:true};this.aoPreSearchCols=[];this.aaSorting=[[0,"asc",0]];this.aaSortingFixed=null;this.asStripClasses=[];this.asDestoryStrips=[];this.sDestroyWidth=0;this.fnFooterCallback=this.fnHeaderCallback=this.fnRowCallback=null;this.aoDrawCallback=[];this.fnInitComplete=null;this.sTableId="";this.nTableWrapper=this.nTBody=this.nTFoot=this.nTHead=this.nTable=null;this.bInitialised=false;this.aoOpenRows=
    3939[];this.sDom="lfrtip";this.sPaginationType="two_button";this.iCookieDuration=7200;this.sCookiePrefix="SpryMedia_DataTables_";this.fnCookieCallback=null;this.aoStateSave=[];this.aoStateLoad=[];this.sAjaxSource=this.oLoadedState=null;this.bAjaxDataGet=true;this.fnServerData=function(a,b,c){j.ajax({url:a,data:b,success:c,dataType:"json",cache:false,error:function(d,f){f=="parsererror"&&alert("DataTables warning: JSON data from server could not be parsed. This is caused by a JSON formatting error.")}})};
    40 this.fnFormatNumber=function(a){if(a<1E3)return a;else{var b=a+"";a=b.split("");var c="";b=b.length;for(var d=0;d<b;d++){if(d%3===0&&d!==0)c=","+c;c=a[b-d-1]+c}}return c};this.aLengthMenu=[10,25,50,100];this.bDrawing=this.iDraw=0;this.iDrawError=-1;this._iDisplayLength=10;this._iDisplayStart=0;this._iDisplayEnd=10;this._iRecordsDisplay=this._iRecordsTotal=0;this.bJUI=false;this.oClasses=n.oStdClasses;this.bSorted=this.bFiltered=false;this.oInit=null}function r(a){return function(){var b=[A(this[n.iApiIndex])].concat(Array.prototype.slice.call(arguments));
     40this.fnFormatNumber=function(a){if(a<1E3)return a;else{var b=a+"";a=b.split("");var c="";b=b.length;for(var d=0;d<b;d++){if(d%3===0&&d!==0)c=","+c;c=a[b-d-1]+c}}return c};this.aLengthMenu=[10,25,50,100,1000,5000];this.bDrawing=this.iDraw=0;this.iDrawError=-1;this._iDisplayLength=10;this._iDisplayStart=0;this._iDisplayEnd=10;this._iRecordsDisplay=this._iRecordsTotal=0;this.bJUI=false;this.oClasses=n.oStdClasses;this.bSorted=this.bFiltered=false;this.oInit=null}function r(a){return function(){var b=[A(this[n.iApiIndex])].concat(Array.prototype.slice.call(arguments));
    4141return n.oApi[a].apply(this,b)}}function s(a){var b,c;if(a.bInitialised===false)setTimeout(function(){s(a)},200);else{sa(a);U(a);K(a,true);a.oFeatures.bAutoWidth&&$(a);b=0;for(c=a.aoColumns.length;b<c;b++)if(a.aoColumns[b].sWidth!==null)a.aoColumns[b].nTh.style.width=v(a.aoColumns[b].sWidth);if(a.oFeatures.bSort)O(a);else{a.aiDisplay=a.aiDisplayMaster.slice();E(a);C(a)}if(a.sAjaxSource!==null&&!a.oFeatures.bServerSide)a.fnServerData.call(a.oInstance,a.sAjaxSource,[],function(d){for(b=0;b<d.aaData.length;b++)u(a,
    4242d.aaData[b]);a.iInitDisplayStart=a._iDisplayStart;if(a.oFeatures.bSort)O(a);else{a.aiDisplay=a.aiDisplayMaster.slice();E(a);C(a)}K(a,false);w(a,d)});else if(!a.oFeatures.bServerSide){K(a,false);w(a)}}}function w(a,b){a._bInitComplete=true;if(typeof a.fnInitComplete=="function")typeof b!="undefined"?a.fnInitComplete.call(a.oInstance,a,b):a.fnInitComplete.call(a.oInstance,a)}function y(a,b,c){o(a.oLanguage,b,"sProcessing");o(a.oLanguage,b,"sLengthMenu");o(a.oLanguage,b,"sEmptyTable");o(a.oLanguage,
  • main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py

    r6818 r6820  
    4141from waeup.sirp.students.studylevel import StudentStudyLevel, CourseTicket
    4242from waeup.sirp.students.vocabularies import StudyLevelSource
     43from waeup.sirp.browser.resources import toggleall
    4344
    4445# Save function used for save methods in manager pages
     
    226227    def update(self, *args, **kw):
    227228        datatable.need()
     229        toggleall.need()
    228230        form = self.request.form
    229231        self.hitlist = []
  • main/waeup.sirp/trunk/src/waeup/sirp/students/browser_templates/containermanagepage.pt

    r6695 r6820  
    99  <select name="searchtype">
    1010    <option value="student_id">with id</option>
    11     <option value="name">with name</option>
     11    <option value="fullname">with name</option>
    1212  </select>
    1313
     
    2121    <input type="hidden" name="old_searchtype"
    2222         tal:attributes="value view/searchtype" />
     23
     24    <input type="checkbox" onClick="toggle(this, 'entries')" /> Select all
     25    <br /><br />
     26
    2327    <table class="display dataTableManage">
    2428      <thead>
    2529        <tr>
    2630          <th>&nbsp;</th>
    27           <th>Student Id</th><th>Name</th>
     31          <th>Student Id</th><th>Fullname</th>
    2832        </tr>
    2933      </thead>
     
    3539          <span tal:content="item/student_id">A123456</span></a>
    3640        </td>
    37           <td tal:content="item/name">Bob</td>
     41          <td tal:content="item/fullname">Bob</td>
    3842        </tr>
    3943      </tbody>
    4044    </table>
     45   
    4146    <div class="actionButtons">
    4247        <input type="submit" name="remove" value="Remove selected" />
Note: See TracChangeset for help on using the changeset viewer.