| | 32 | S3CRUD has filter forms integrated in the /datatable and /datalist pages. |
| | 33 | |
| | 34 | For these pages, the filter widgets are configured per resource with the "filter_widgets"-setting like: |
| | 35 | |
| | 36 | {{{ |
| | 37 | s3db.configure(tablename, |
| | 38 | filter_widgets=[ |
| | 39 | S3TextFilter(["name", "email", "comments"], |
| | 40 | label=T("Search"), |
| | 41 | comment=T("Search for office by text.")), |
| | 42 | S3OptionsFilter("organisation_id", |
| | 43 | label=messages.ORGANISATION, |
| | 44 | comment=T("Search for office by organization."), |
| | 45 | represent="%(name)s", |
| | 46 | widget="multiselect"), |
| | 47 | S3OptionsFilter("location_id$L1", |
| | 48 | location_level="L1", |
| | 49 | widget="multiselect") |
| | 50 | ]) |
| | 51 | }}} |
| | 52 | |
| | 53 | The widgets appear in the form in list order. |
| | 54 | |
| | 55 | Additionally, there are a number of controller options for the s3_rest_controller call: |
| | 56 | |
| | 57 | {{{ |
| | 58 | output = s3_rest_controller(prefix, resourcename, |
| | 59 | filter_submit_url = submit_url, |
| | 60 | filter_ajax_url = ajax_url, |
| | 61 | filter_formstyle = formstyle, |
| | 62 | filter_submit = submit |
| | 63 | ) |
| | 64 | }}} |
| | 65 | |
| | 66 | ||'''Option'''||'''Type'''||'''Function'''||'''Default'''|| |
| | 67 | ||filter_submit_url||URL string||where to request filtered data from||URL of the current call|| |
| | 68 | ||filter_ajax_url||URL string||where to request updated filter options from||URL of the current call with /filter method|| |
| | 69 | ||filter_formstyle||Formstyle function||Alternative formstyle for the filter form||built-in formstyle|| |
| | 70 | ||filter_submit||String||Label for the submit button or tupel of (label, class) to also specify a CSS class for the button||T("Search")|| |