123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- <?xml version="1.0" encoding="EUC-KR"?>
- <xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.w3.org/2002/01/xforms" xmlns:ev="http://www.w3.org/2001/xml-events">
- <xhtml:head>
- <xhtml:title>Untitle</xhtml:title>
- <model id="model1">
- <instance id="instance1">
- <root xmlns="">
- <grid_colorpicker>
- <item/>
- <item/>
- <item/>
- <item/>
- <item/>
- <item/>
- <item/>
- <item/>
- <item/>
- <item/>
- </grid_colorpicker>
- </root>
- </instance>
- <script ev:event="xforms-model-construct-done" type="javascript">
- <![CDATA[
- var style = new Array("#fcd2c1" , "#ffe79d" , "#f3e1bf" , "#c6b3de" , "#b9e5fb" , "#f7a08b" , "#fec34d" , "#dec6a4" , "#c8e67b" , "#43c8f5" );
- for(var i = 0; i<style.length; i++) {
- grid_colorPicker.cellStyle("background-color", i, 0) = style[i];
- }
- ]]>
- </script>
- </model>
- <script type="javascript">
- <![CDATA[
-
- var _pWinObj; // 부모 윈도우 오브젝트
- var _pGridObj; // 부모 그리드 오브젝트
-
- function setColorState(colorState) {
-
- var pGridObj_statenode = _pGridObj.attribute("_statenode");
-
-
- var pGridStateNodePath = "";
- var pGridStateNode;
-
- if(pGridObj_statenode != "") {
- pGridStateNodePath = pGridObj_statenode
- pGridStateNode = _pWinObj.instance1.selectSingleNode(pGridStateNodePath);
- }
- else if(pGridObj_statenode == "") {
- var pGridObjNodeSet = _pGridObj.attribute("nodeset");
- var pGridObjNodeSetParentNodePath = "";
- var pGridObjNodeSetArray = pGridObjNodeSet.split("/");
- for(var i=1; i<pGridObjNodeSetArray.length-1; i++) {
- pGridObjNodeSetParentNodePath += "/" + pGridObjNodeSetArray[i];
- }
-
- var pGridSelMode = _pGridObj.selectionMode;
- var nodeName = "state";
- if(pGridSelMode == "free") {
- nodeName = "cellState";
- }
- else if(pGridSelMode == "list" || pGridSelMode == "byrow") {
- nodeName = "rowState";
- }
-
- pGridStateNodePath = pGridObjNodeSetParentNodePath + "/" + nodeName;
- pGridStateNode = _pWinObj.instance1.selectSingleNode(pGridStateNodePath);
- }
-
- var pGridStateNodeValue = "";
- if(pGridStateNode == null)
- _pWinObj.model.makeNode(pGridStateNodePath);
- else
- pGridStateNodeValue = _pWinObj.model.getValue(pGridStateNodePath);
-
- pGridStateNodeValue += colorState;
- _pWinObj.model.setValue(pGridStateNodePath, pGridStateNodeValue);
- }
- ]]>
- </script>
- </xhtml:head>
- <xhtml:body>
- <datagrid id="grid_colorPicker" nodeset="/root/grid_colorpicker/item" colsep="^" colwidth="100" defaultrows="10" focuscolor="transparent" mergecellsfixedrows="bycolrec" rowheight="20" rowsep="|" style="left:0px; top:0px; width:102px; height:202px; border-color:#c0c0c0; border-style:solid; ">
- <col ref="item"/>
- <script ev:event="onclick" type="javascript">
- <![CDATA[
- _pWinObj = parent.window;
- _pGridObj = _pWinObj.javaScript._gridObj;
-
- var selectedColor = grid_colorPicker.cellStyle("background-color", grid_colorPicker.row, 0);
- var pGridSelMode = _pGridObj.selectionMode;
- var returnColorState = "";
- var i;
-
- /* set color */
- if(pGridSelMode == "free") {
-
- var cellCollection = _pGridObj.selectedCells;
- var cell;
-
- for(i=0; i<cellCollection.length; i++) {
- cell = cellCollection.item(i);
- _pGridObj.cellStyle("background-color", cell.row, cell.col) = selectedColor;
- returnColorState += selectedColor + "^" + cell.row + "^" + cell.col + "|";
- }
-
- // setColorState("cellState", returnColorState);
- }
- else if(pGridSelMode == "list" || pGridSelMode == "byrow") {
-
- var row;
-
- for(i=0; i<_pGridObj.selectedRows; i++) {
- row = _pGridObj.selectedRow(i);
- _pGridObj.rowstyle(row, "data", "background-color") = selectedColor;
- returnColorState += selectedColor + "^" + row + "|";
- }
-
- // setColorState("rowState", returnColorState);
- }
-
- setColorState(returnColorState);
- _pWinObj.iviewer_colorPicker.attribute("height") = 0;
- ]]>
- </script>
- </datagrid>
- </xhtml:body>
- </xhtml:html>
|