Grid cell colwidth

I have set the column width for all columns at runtime. However, if the text is longer, the cell width simply expands. Even though I have set “cellstyle: white-space:nowrap;overflow:hidden; and grid style table-layout:fixed.” What else is missing to set a fixed cell width?

The AppStudio Grid control is meant to be an easy to use way to display data. It’s based on the HTML Table object.

You’ve figured out that you can style the cells using CSS. You can find lots of resources on the web with information for that - we here at AppStudio can’t claim to be experts on how to use CSS.

(Usually, if I need more than a simple table, I use the DataTable control)

Grid style add “table-layout: fixed;

Even with table-layout: fixed; in the style property, it did not work for me. So I added Grid1.style.wordWrap = “break-word” to the code, still no luck, but I think is needed anyway. So I made sure the width property of the columns were defined (required for fixed columns). They were both in the colWidths property at design time and manually coded using Grid1.setColumnWidth(i,A) in a loop for each column (i) with percent A = n%. Still no go. This was infuriating also because other grids in my app were performing correctly. Then I just happened to stumble upon the titles property at design time which I wasn’t using and decided to put something in. It worked.

Strange, but this workaround did the job for me.

John

Hi John, thank you for your suggestions. I’ve implemented them all. The cells now actually have a fixed length. However, they are stretched vertically, and the text is split across multiple lines. Is there a parameter that prevents this and simply truncates the text (overflowhidden isn’t enough).

This worked for me:

Grid1.cell(1,0).style.overflow = “hidden”
Grid1.setValue(1,0,“nowisthetimeforallgoodpeopletocometotheaidoftheircountry”)

I’ll try, Do you mean the 2nd line seriously?

Grid1.cell(x,x).style.whiteSpace = “nowrap”
As johnc said, a title must be specified in the design screen even if you take it out programmatically.