Browse Source

定额下拉菜单调整

zhangweicheng 6 years ago
parent
commit
9fadccdf1f
1 changed files with 8 additions and 15 deletions
  1. 8 15
      public/web/tree_sheet/tree_sheet_helper.js

+ 8 - 15
public/web/tree_sheet/tree_sheet_helper.js

@@ -508,9 +508,9 @@ var TREE_SHEET_HELPER = {
                 $editor.css("background", 'white');
                 $editor.css("width", cellRect.width);
                 $editor.css("height", cellRect.height);
-                $editor.attr("gcUIElement", "gcEditingInput");//padding:0
+                $editor.attr("gcUIElement", "gcEditingInput");//padding:0  //value="${context.sheet.getValue(context.row,context.col)}"
                 $editor.html(` <div class="input-group input-group-sm">
-                                <input type="text" id="esInput" class="form-control" aria-label="Text input with dropdown button" autocomplete="off" value="${context.sheet.getValue(context.row,context.col)}"  style="background-color:${cellStyle.backColor}">
+                                <input type="text" id="esInput" class="form-control" aria-label="Text input with dropdown button" autocomplete="off"   style="background-color:${cellStyle.backColor}">
                                 <div class="">                           
                                     <div class="triangle-border_dropdown tb-border_dropdown" id="esBtn" style="left: ${cellRect.width - 15+"px"}"></div>
                                 </div>
@@ -523,8 +523,9 @@ var TREE_SHEET_HELPER = {
 
             TreeNodeCellType.prototype.updateEditor = function (editorContext, cellStyle, cellRect, context) {
                 let me = this;
-                console.log("updateEditor -------");
                 $(editorContext).append(`<div><ul class="es-list" style="display: block;background-color:${cellStyle.backColor}"></ul></div>`);//<li class="" data-value="" style=""> <br></li>
+                $('#esInput').val(context.sheet.getValue(context.row,context.col));
+                $('#esInput').select();
                 projectObj.project.Ration.getNearRations(initNode.data,function(rations){
                     if(rations.length > 0){
                         let li_html = "";
@@ -545,25 +546,17 @@ var TREE_SHEET_HELPER = {
                     $("#esBtn").bind('click',function(e){
                         $(".es-list").toggle();
                     });
+                    if( $('#esInput').val()) setCursor( $("#esInput")[0], $('#esInput').val().length)
                 });
             };
             TreeNodeCellType.prototype.setEditorValue = function (editor, value, context) {
-                /*   $('#esInput').val(value);
-                 this.displayText = "hehe";*/
+
+                 $('#esInput').val(value);
             };
             TreeNodeCellType.prototype.getEditorValue = function (editor, context) {
-                console.log("get value");
-                /*if(this.isEscKey !=true&& updateCallback){
-                 updateCallback();
-                 }*/
                 this.isEscKey = false;
                 console.log($('#esInput').val());
-                return   $('#esInput').val();
-            };
-            TreeNodeCellType.prototype.isReservedKey = function (e, context) {
-                //cell type handle tab key by itself
-                this.isEscKey = e.keyCode === GC.Spread.Commands.Key.esc;
-                return false;
+                return  $('#esInput').val()!==''? $('#esInput').val():null;
             };
         }