开发者

When not to use a gridview

开发者 https://www.devze.com 2023-04-08 02:24 出处:网络
I Remember reading an article by Marcus Egger a while back about when to and when not to use a gridview style control. I can\'t find it now...

I Remember reading an article by Marcus Egger a while back about when to and when not to use a gridview style control. I can't find it now...

I have a member on my team who has just found some jquery grids and is determined to use them fo开发者_StackOverflow中文版r everything...

I mean everything from lists of data (which I have no problem with) to using it as a primary means for CRUD on single items (which I find lazy and overkill).

Does anyone have an opinion on this? Any good articles? Am I being too picky?


I have used jqGrid control for some projects, and find it to be very powerfull and customizable. And there is a great support for all possible questions here on stackoverflow by Oleg.

However, it is impossible to give reccomendation for any scenario, as there is no silver bullet, and not even jqGrid is optimal for all scenarios.

When you need to have ajax loading and paging, (multiple column) sorting, filtering, inplace editing, enumerated column values, jQuery UI theming - jqGrid is one of the best tools. It supports all that, and different types of data formats, including json and xml.

However, sometimes you only need simple web app for administrator to perform CRUD operations on some codebooks, without requirements for specific looks, ajax and all the bells and whistles, and jqGrid is overkill in these cases, especially if autogenerated mvc scaffolding or asp.net dynamic data application does the job well. Or maybe there is no requirement for grid, if there is only a list of something needed, and it can be done in 15 minutes, then you should NOT use any grid control. There are also cases when displayed data can be more user-friendly, i.e. contact information - you will find someone a lot faster if you display large name and/or picture and smaller address, phone etc aside in a unordered list than you will do the same in a grid-styled display of same information (and you cannot put picture as it will make your row height too big).

Regarding "lazy" part of your question, I would not agree as there is often more work to make jqGrid working than use some out-of-the-box component. With jqGrid you can implement inplace editing (inside jqGrid), but you can also make completely customized form (not different from one someone expects at edit page) which is loaded into edit dialog.


Why don't you use a repeater control, then you have full control of your markup.

Or do something like that:

  <table> 

     foreach(var i in data) {
         <tr>
         <td>....etc </td>    </tr> 
     } 

   </table>
0

精彩评论

暂无评论...
验证码 换一张
取 消