var create_flexigrid_for = { search: { keys: function(query) { create_flexigrid('grid-keys', { url: '/api/2/db/keys?query=' + encodeURIComponent(query), colModel: [ { display: texts.misc.count, name: 'count_all', width: 80, sortable: true, align: 'right' }, { display: texts.osm.key, name: 'key', width: 500, sortable: true } ], sortname: 'count_all', sortorder: 'desc', emptymsg: 'No keys found.', preProcess: function(data) { data.rows = jQuery.map(data.data, function(row, i) { return { 'cell': [ print_with_ts(row.count_all), link_to_key_with_highlight(row.key, query) ] }; }); return data; } }); }, values: function(query) { create_flexigrid('grid-values', { url: '/api/2/search/values?q=' + encodeURIComponent(query), colModel: [ { display: texts.misc.count, name: 'count_all', width: 80, sortable: true, align: 'right' }, { display: texts.osm.key, name: 'key', width: 250, sortable: true }, { display: texts.osm.value, name: 'value', width: 500, sortable: true } ], sortname: 'count_all', sortorder: 'desc', emptymsg: 'No values found.', preProcess: function(data) { data.rows = jQuery.map(data.data, function(row, i) { return { 'cell': [ print_with_ts(row.count_all), link_to_key(row.key), link_to_value_with_highlight(row.key, row.value, query) ] }; }); return data; } }); }, tags: function(query) { var q = query.split('=', 2); create_flexigrid('grid-tags', { url: '/api/2/search/tags?q=' + encodeURIComponent(query), colModel: [ { display: texts.misc.count, name: 'count_all', width: 80, sortable: true, align: 'right' }, { display: texts.osm.key, name: 'key', width: 300, sortable: true }, { display: texts.osm.value, name: 'value', width: 500, sortable: true } ], sortname: 'count_all', sortorder: 'desc', emptymsg: 'No tags found.', preProcess: function(data) { data.rows = jQuery.map(data.data, function(row, i) { return { 'cell': [ print_with_ts(row.count_all), link_to_key_with_highlight(row.key, q[0]), link_to_value_with_highlight(row.key, row.value, q[1]) ] }; }); return data; } }); } } }; function page_init() { page_init2(); }