Because of the company's previous architectural requirements, so for the Dhtmlxgrid to do a simple study, referring to the example given by Dhtmlxgrid to explore
1, must introduce the JS package
- <link rel="STYLESHEET" type="text/css" href= "css/dhtmlxgrid.css">
- <link rel="stylesheet" type="text/css" href= "Css/dhtmlxgrid_dhx_skyblue.css" >
- <link rel="STYLESHEET" type="text/css" href= "Css/dhtmlxcalendar.css" >
- <script src="Js/dhtmlxcommon.js"></script><!--dhtmlx base js-->
- <script src="Js/dhtmlxgrid.js"></script><!-- Dhtmlxgrid Foundation js-->
- <script src="Js/dhtmlxgridcell.js"></script><!--dhtmlxgrid base js-- >
- <script src="Js/dhtmlxcalendar.js"></script><!-- Support for date controls--
- <script src="Js/dhtmlxgrid_excell_dhxcalendar.js"></script><!-- Support for date controls--
- <link rel="STYLESHEET" type= "text/css" href= "css/dhtmlxcalendar_dhx_ Skyblue.css ">
2. Initialization code
2.1. Put a table container on the page first
- <div id= "gridbox" style="width:503px;height:120px;background-color:white;" ></div>
2.2. Page initialization
- <script>
- Mygrid = new Dhtmlxgridobject (' Gridbox ');//similar to a declaration
- Mygrid.setimagepath ("/imgs/"); Set Picture storage path
- Mygrid.setheader ("Name,date of Birth, first book Published");//Set table header name
- Mygrid.setinitwidths ("*,100,100"); Set table Initial column width
- Mygrid.setcolalign ("Left,center,center");//Set table alignment
- Mygrid.setcoltypes ("Ed,dhxcalendar,dhxcalendara");//Set the data type of each column
- Mygrid.setcolsorting ("Str,date,date"); Set the sort type for each column
- Mygrid.setskin ("Dhx_skyblue"); Set style
- Mygrid.init (); To initialize
- Mygrid.loadxml ("Data.xml"); Loading external Data
- </Script>
Report:
SetcoltypesSupported column types
Ro |
Read-only |
Ed |
Small text, double-click Edit in place |
Txt |
Large amount of text, double-click to pop up a text area for editing |
Ch |
check box, the value is 1, the unselected value is 0 |
Ra |
Single box, only one of the columns is selected, with a value of 1 selected |
Coro |
Drop-down list, users can only select values that are already in the list |
Co |
Compound drop-down list, which can be selected by the user or self-input |
Img |
Picture, read-only, value for the URL of the picture |
Link |
Link, the format of the value is "link text ^ link address ", non-normal hyperlink notation. (need to load Dhtmlxgrid_excell_link.js file to support it) |
Calendar |
Date, double-click the pop-up calendar. date format is mm/dd/yyyy. You need to load the Dhtmlxgrid_excell_calendar.js file to support it, and before you load the file, define the global variables _css_prefix,_js_prefix as follows:<script >_css_prefix= "styles/"; _js_prefix= "js/"; </script> |
setcolsortingSupported Sort types:
Int |
Integral type |
Str |
String |
Date |
Date |
Dhtmlxgrid form Notes