Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Tricky problem for ng-repeat directive
Message
From
25/04/2015 03:50:13
 
General information
Forum:
Javascript
Category:
Other
Miscellaneous
Thread ID:
01619110
Message ID:
01619113
Views:
33
>Hi everybody,
>
>I am not sure how to approach this problem, so I'm looking for ideas. I have a table with 4 fixed columns and about 15 more columns which are boolean. I would like to be able to generate html table using names of the columns and automatically create checkboxes in these columns with correct ng-model. I am not sure how to express this.
>
>Here is what I have so far:
>
>
><table id="searchTable" ng-show="results.length>0"
>                       class="table table-responsive table-hover table-list"
>                       style="width:800px;">
>                    <thead search-table-header table="table" search="search()">
>
>                    </thead>
>                    <tbody>
>                        <tr ng-repeat="result in results">
>                            <td>
>                                {{ result.salespoint }}
>                            </td>
>                            <td>
>                                {{ result.id }}
>                            </td>
>                            <td>
>                                {{ result.description }}
>                            </td>
>                            <td>
>                                <select class="form-control" ng-model="result.mode"                                        
>                                    ng-options="s.modeId as s.description for s in metaData.salespointModes">
>                                </select>
>                            </td>                            
>                        </tr>
>                    </tbody>
>                </table>
>
>for these 4 columns I know names of. I don't know how to write the code for the rest of the columns in the result object.
>
>Also, ideally, the first 4 columns should always be visible on the page (locked) and I should be able to scroll to the rest of the columns.
>
>There are more requirements for these extra columns (say, the order of these columns will be based on does the client have valid licenses for that type or not), but for now I'm just trying to figure out how to generate these columns on the page and bind properly.
>
>Thanks in advance.

Couple of possible approaches in this thread which should be adaptable to your needs :
http://stackoverflow.com/questions/18357370/angularjs-building-a-dynamic-table-based-on-a-json
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform