Is there a way to create a table using GridView without a dataprovider so that it builds an empty table with just table headers, so I can insert rows using js?
Matt
Is there a way to create a table using GridView without a dataprovider so that it builds an empty table with just table headers, so I can insert rows using js?
Matt
Just wondering why would you need a GridView if you do not have data to start with? You could render a normal ‘table’ and ‘tr / td’ tag through javascript.
GridView is normally used when you have data that you wish to paginate, sort, and filter using the tabular format.
If you are still keen you may want to look at ArrayDataProvider or extend and build your own DataProvider.
I am currently displaying a table in the standard <table> Format. But wanted to know if it was possibly to make use of the widgets to create it automagically.
Gridview requires a valid dataProvider. Just copy the HTML.
you could use an ArrayDataProvider with an empty array if you really need a gridview.
is Tabular Grid support ArrayDataProvider
sure.
TabularForm::widget didn’t support ArrayDataProvider
got error while trying to initiate
The ‘dataProvider’ property must be set and must be an instance of ‘\yii\data\ActiveDataProvider’.
I suppose you are talking about the Tabular Form extension. It supports only ActiveDataProvider (because it relies on the ActiveRecord model to batch update records).
Note: This is different from the yii gridview (it actually uses Yii GridView’s capability to generate a tabular form).