PDA

View Full Version : Dynamically sized columns in Windowlists



Zeus
March 16th, 2010, 10:09
Does anyone know of a method/technique for resizing the column width of a windowlist thats set to render with the
<fillwidth /> option?

I can't see a method in the reference guide and I have tried to poke the value of the width using columns[1].width[1] but nothing I have tried seems to work.

Basically I want to adjust the width of a column determined by the number of columns and the current window size. The idea being to have all columns equally sized and using the full width of the available window space.

Here's there windowlist definition (summarised):


<windowlist name="results">
<anchored> ... </anchored>
<class>resultsitem</class>
<datasource>.results</datasource>
<skipempty />
<columns>
<width>250</width> -- starting width for a single column
<fillwidth />
</columns>
<script>
...

function updateColumnWidths()
local w, h = window.getSize();
local newcolw = w / getTableColumns()); -- returns num of columns.

columns[1].width[1] = newcolw;
applySort();
end

....

</script>
</windlowist>

Does anyone have any creative ideas? Any help would be much appreciated.

Z.

Zeus
March 16th, 2010, 10:58
Nevermind, I re-implemented the windowlist as a template and setup multiple instances which I can control the visibility of depending upon how many columns are added.

Thanks anyways.