What sets column width in this case? Why it is shifting with each record? Is this a Bootstrap or Yii2 issue? I tried to analyse generated code with Chrome Dev Tools, but got no conclusions. As you can see, there is a lot of empty spaces in both columns, so column width shifting should not occur.
Most important – how to prevent that? How to make sure, that every view will look exactly the same, no matter what data will be printed inside DetailView?
This got nothing to do with Yii - browser is deciding how to render the table based on its content if column width is not set. You can set the css style with with or add class like bootstrap col-- to keep the column size in order.
As you can see, I have came with the same conclusions.
However, you’re approach of using col-like classes sounds interesting, in the light of fact, that you don’t have direct access to HTML code generated by DetailView, therefore you can’t directly interfere with classes added to each <td> or <th> element of it. Care to explain, how you would like to override DetaliView generation process to be able to inject own classes to generated HTML code for DetailView?