JavaScript UI Libraries & Blazor Components Suite – Smart UI › Forums › Data Grid › generate grid column from html
Tagged: Datagrid
- This topic has 4 replies, 2 voices, and was last updated 2 years, 8 months ago by admin.
-
AuthorPosts
-
February 3, 2022 at 9:30 am #102836Joko PitoyoParticipant
i need help, howto build grid column from html because i wanto restric colum access based on PHP session, for example,
`
<smart-grid>
<th>
<td data-options=”fieldName:’name'”>Name</td>
<?php isset($_SESSION[‘user_level’]){
if($_SESSION[‘user_level’]==’admin’){?>
<td data-options=”fieldName:’phone'”>Phone</td>
<?php }} ?>
</td></smart-grid
`
February 3, 2022 at 9:41 am #102838Joko PitoyoParticipanti try this code, but not working:
`
<div>
<div> <smart-grid id=”table”></div>
<div> <table></div>
<div> <thead></div>
<div> <tr></div>
<div> <th scope=”col”>Country</th></div>
<div> <th scope=”col”>Area</th></div>
<div> <th scope=”col”>Population_Rural</th></div>
<div> <th scope=”col”>Population_Total</th></div>
<div> <th scope=”col”>GDP_Total</th></div>
<div> </tr></div>
<div> </thead></div>
<div> <tbody></div>
<div> <tr></div>
<div> <td>Brazil</td></div>
<div> <td>8515767</td></div>
<div> <td>0.15</td></div>
<div> <td>205809000</td></div>
<div> <td>2353025</td></div>
<div> </tr></div>
<div> <tr></div>
<div> <td>China</td></div>
<div> <td>9388211</td></div>
<div> <td>0.46</td></div>
<div> <td>1375530000</td></div>
<div> <td>10380380</td></div>
<div> </tr></div>
<div> <tr></div>
<div> <td>France</td></div>
<div> <td>675417</td></div>
<div> <td>0.21</td></div>
<div> <td>64529000</td></div>
<div> <td>2846889</td></div>
<div> </tr></div>
<div> <tr></div>
<div> <td>Germany</td></div>
<div> <td>357021</td></div>
<div> <td>0.25</td></div>
<div> <td>81459000</td></div>
<div> <td>3859547</td></div>
<div> </tr></div>
<div> <tr></div>
<div> <td>India</td></div>
<div> <td>3287590</td></div>
<div> <td>0.68</td></div>
<div> <td>1286260000</td></div>
<div> <td>2047811</td></div>
<div> </tr></div>
<div> <tr></div>
<div> <td>Italy</td></div>
<div> <td>301230</td></div>
<div> <td>0.31</td></div>
<div> <td>60676361</td></div>
<div> <td>2147952</td></div>
<div> </tr></div>
<div> <tr></div>
<div> <td>Japan</td></div>
<div> <td>377835</td></div>
<div> <td>0.07</td></div>
<div> <td>126920000</td></div>
<div> <td>4616335</td></div>
<div> </tr></div>
<div> <tr></div>
<div> <td>Russia</td></div>
<div> <td>17098242</td></div>
<div> <td>0.26</td></div>
<div> <td>146544710</td></div>
<div> <td>1857461</td></div>
<div> </tr></div>
<div> <tr></div>
<div> <td>United States</td></div>
<div> <td>9147420</td></div>
<div> <td>0.19</td></div>
<div> <td>323097000</td></div>
<div> <td>17418925</td></div>
<div> </tr></div>
<div> <tr></div>
<div> <td>United Kingdom</td></div>
<div> <td>244820</td></div>
<div> <td>0.18</td></div>
<div> <td>65097000</td></div>
<div> <td>2945146</td></div>
<div> </tr></div>
<div> </tbody></div>
<div> </table></div>
<div> </smart-grid></div>
</div>
<div>`</div>
February 3, 2022 at 12:37 pm #102840adminKeymasterHi Joko,
The Grid does not support such scenario. You can data bind it to Array, JSON, CSV, TSV or XML data.
Best regards,
Peter StoevSmart UI Team
https://www.htmlelements.com/February 4, 2022 at 3:42 am #102847Joko PitoyoParticipantany plan to add this feature?
February 4, 2022 at 7:28 am #102855adminKeymasterHi Joko,
If you have such scenario, you may use the Table instead – https://www.htmlelements.com/demos/table/basic/. It’s purpose is to replace the HTML Table. The DataGrid is for the more advanced and complex scenarios.
Best regards,
Peter StoevSmart UI Team
https://www.htmlelements.com/ -
AuthorPosts
- You must be logged in to reply to this topic.