1 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 * function used for index manipulation pages
8 * Hides/shows the inputs and submits appropriately depending
9 * on whether the index type chosen is 'SPATIAL' or not.
11 function checkIndexType()
14 * @var Object Dropdown to select the index type.
16 $select_index_type = $('#select_index_type');
18 * @var Object Table header for the size column.
20 $size_header = $('#index_columns thead tr th:nth-child(2)');
22 * @var Object Inputs to specify the columns for the index.
24 $column_inputs = $('select[name="index[columns][names][]"]');
26 * @var Object Inputs to specify sizes for columns of the index.
28 $size_inputs = $('input[name="index[columns][sub_parts][]"]');
30 * @var Object Span containg the controllers to add more columns
32 $add_more = $('#addMoreColumns');
34 if ($select_index_type.val() == 'SPATIAL') {
35 // Disable and hide the size column
37 $size_inputs.each(function(){
39 .attr('disabled', true)
43 // Disable and hide the columns of the index other than the first one
45 $column_inputs.each(function() {
46 $column_input = $(this);
49 .attr('disabled', true)
56 // Hide controllers to add more columns
59 // Enable and show the size column
61 $size_inputs.each(function() {
63 .attr('disabled', false)
67 // Enable and show the columns of the index
68 $column_inputs.each(function() {
70 .attr('disabled', false)
74 // Show controllers to add more columns
84 * @description <p>Ajax scripts for table index page</p>
86 * Actions ajaxified here:
88 * <li>Showing/hiding inputs depending on the index type chosen</li>
91 * @name document.ready
94 $(document).ready(function() {
96 checkIndexName("index_frm");
97 $('#select_index_type').live('change', function(event){
98 event.preventDefault();
100 checkIndexName("index_frm");