Should I use a dojo grid or create a table with html?
I use a dojo grid to get the benefits of table layout, event handling (cell selection, navigation with keyboard, column selection). It also gives me something unwanted (row selection, background color, dnd, sort, and the table header)开发者_C百科. Are there any methods to customize dojo's grid? Or it might be easier to create a widget of my own?
I guess it still up to your choice/resources. I know you can customize dojo grid as the other JavaScript library can. Why not try other library like jquery flexgrid.
Before I enhanced a module with dojo grid but when I develop a module I end up create my own(just a table not exactly a grid :). Because it also defend your skills and the output as client request.
Assuming that you already use dijit widgets and don't want to include more frameworks... The grid itself is ok. It's fast and has enough features. The problem is that you need a store implementing dojo.data.api.Read - and dojo.data.* is the worst js store api/implementation I know (personal opinion).
I would suggest...
... write your own widget if you just want to show a few lines and if you don't want to use webservices to load the data for your grid.
... use dojo grid and dojo.data.FileItemReadStore if you want to load your data via a simple json service and if you can modify the service (parameters and response structure). If you cannot modify the server request and response format be careful, in most cases you'll have to write your own store which is much more work than it should, other frameworks are easier to use.
... usw dojo gird if you want to use a REST service. Dojo REST store implementation works fine.
Imho writing your own code is only for really simple situations the best choice.
As for all dojo/dijit/dojox widgets there is no best practice document on how to style it. The standard way is firebug, inspect element, modify, add to custom skin. The grid is easy to style because there are all required dom nodes and changes do not affect other widgets. Do not trust any documentation ;-) e.g. afaik the grid produces not the html as described in your link.
精彩评论