EasyUI Forum
May 21, 2024, 09:54:36 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
  Home Help Search Login Register  
  Show Posts
Pages: [1] 2
1  General Category / Bug Report / onLoadSuccess getRowIndex on: November 03, 2014, 02:49:07 PM
I am trying to delete some rows that are coming back after delete when I sort. (reload url with sort and order). the data comes back obviously with the deleted rows. So when I delete them I push them to and array. when I sort the datagrid again on a column it pulls back the data, then I was going to loop through and remove the rows manually in the onLoadSuccess event.  However the getRowIndex gives me back the ole -1 everytime. 

function addDeleteRow(rows){
  for(var i = 0; i < rows.length; i++){
   deletedRows.push(rows);
  }
}


$('#outagetable').datagrid({
url:'./scripts/outages.php?date=' + date + '&type=' + $("input[name=types]:checked").val(),
columns:[[
                  {field:'tradedate', title:'Tradedate', width:70, sortable:true},
                  {field:'he', title:'HE', width:35, sortable:true},
                  {field:'hours_out', title:'HR Out', width:45, sortable:true},
                  {field:'company', title:'Company', width:65, sortable:true},
                  {field:'kv', title:'KV', width:45, sortable:true},
                  {field:'from_station', title:'From', width:85, sortable:true},
                  {field:'to_station', title:'To', width:85, sortable:true},
                  {field:'ems_equipment', title:'Equipment', width:220, sortable:true},
                  {field:'planned_start', title:'Planned Start', width:120, sortable:true},
                  {field:'planned_end', title:'Planned End', width:120, sortable:true},
                  {field:'actual_start', title:'Actual Start', width:120, sortable:true},
                  {field:'actual_end', title:'Actual End', width:120, sortable:true},
                  {field:'request_status', title:'Status', width:90, sortable:true},
                  {field:'priority', title:'Priority', width:90, sortable:true},
                  {field:'equip_req_type', title:'Request Type', width:90, sortable:true},
                  {field:'from_ca', title:'From CA', width:60, sortable:true},
                  {field:'to_ca', title:'To CA', width:60, sortable:true},
                  {field:'what', title:'Status', width:90, hidden:false, sortable:true}
                  
               
               ]],
onLoadSuccess:function(){
                  
   for(var i = 0; i < deletedRows.length; i++){
      var index = $(this).datagrid('getRowIndex', deletedRows);
        //alert(JSON.stringify(deletedRows));
       //alert(index);
       //$(this).datagrid('deleteRow', index);
   }
                  
}
});


there is a bit of the offending code. Might not be a bug, might just be a lose nut between the chair and the keyboard
2  General Category / General Discussion / Re: datagrid multiselect suggestion on: November 03, 2014, 02:41:30 PM
Nice,
I added this bit to make the blue html selection go away

body {
         -webkit-user-select: none;
         -khtml-user-select: none;
         -moz-user-select: none;
         -o-user-select: none;
         user-select: none;
         }
3  General Category / General Discussion / datagrid multiselect suggestion on: October 29, 2014, 11:00:25 AM
I think it would be sweet if I could click a row and hold shift and then click somewhere down the list that it would select all those rows.

Also it would be nice to be able to drag select a single row or a group of columns.

Anyway, just my two cents


4  General Category / Bug Report / datagrid columns squish when created by <table> tag on: October 10, 2014, 09:34:24 AM
So when I load a table after it has been created using this code.

<!--<table class="easyui-datagrid" title="DataGrid" style="width:700px;height:250px" id='NodeidConstraints' data-options="
                     url:'./scripts/constraintsbynodeid.php?nodeid=AEC',
                     fit:true,
                     title:'Constraint List by Nodeid',
                     toolbar:'#nodetoolbar',
                     onClickRow:onClickNodeidConstraints,
                     fitColumns:true
                  ">
               <thead>
                  <tr>
                     <th data-options="field:'constraintname',title:'Constraint Name',width:250,align:'left', sortable:true"></th>
                     <th data-options="field:'factor',title:'Factor',width:35,align:'right',styler:stylefunction3, sortable:true"></th>
                     <th data-options="field:'tradedate',title:'Last Date',width:65,align:'left',styler:stylefunction3, sortable:true"></th>
                  </tr>
               </thead>
            </table>-->

with toolbar

<div id="nodetoolbar">
         <label>Nodeid : </label>
         <input type="text" id='nodeid_cb'>
      </div>

when I use the nodeid_cb on select and reload with new url.  the headers squished together and the column widths were jacked up. 

If I switch to a div and create the table programatically

$('#NodeidConstraints').datagrid({
   fit:true,
   title:'Constraint List by Nodeid',
   toolbar:'#nodetoolbar',
   onClickRow:onClickNodeidConstraints,
   url:'./scripts/constraintsbynodeid.php?nodeid=AEC',
   columns:[[
      {field:'constraintname',title:'Constraint Name',width:250,align:'left', sortable:true},
      {field:'factor',title:'Factor',width:35,align:'right',styler:stylefunction3, sortable:true},
      {field:'tradedate',title:'Last Date',width:65,align:'left',styler:stylefunction3, sortable:true}
      ]],
      onLoadSuccess:function(){
      }
   });

Then I don't have any issues with headers squishing up next to each other.  and the column widths are correctly placed.

So I have worked around this, but it is definitely a pretty annoying bug

here is what it looks like. check out the headers. yuk


5  General Category / EasyUI for jQuery / Re: Disabling autoUpdate and saving all the objects in edatagrid ? on: October 07, 2014, 08:38:08 PM
I believe you can remove or comment out the updateUrl: option and this will stop it from updating the single row.

I would assume that you could create a save button in a toolbar and have the user select that and send the row through ajax as json and then on success reload the edatagrid.

I have not tried this, but am thinking of something similar. 
6  General Category / EasyUI for jQuery / Re: question about checkbox in datagrid on: October 06, 2014, 06:12:38 PM
I guess to answer my own question We could just use a combobox editor in place of the checkbox field
7  General Category / EasyUI for jQuery / Re: question about checkbox in datagrid on: October 06, 2014, 06:07:54 PM
Would be nice to see an option for checkbox that would allow you to put the title in there instead of the check. your code above right of tells me you are going to use the word title for every checkbox in that datagrid. Works for a single, but going to have to look at how to make that work for multiple checkbox columns
8  General Category / Bug Report / Re: DND multiselect:true single click hold drag does not work on: October 06, 2014, 05:47:18 PM
sorry Lets just state it this way

singleSelect:false,
dragSelection: true,
onLoadSuccess:function(){
  $(this).datagrid('enableDnd');
}

This code above: when i click hold and drag a single row, it starts the drag event but the source is blank (nothing is being dragged), unless I select the row first, then click hold and drag.  This to me is goofy behavior.

What I would expect:

If I click on a bunch of rows highlighting them, and drag them it should drag them over to whatever datagrid I am targeting.  This works

If I attempt to drag a single row I should be able to mouse over it and click hold and drag it over to the other datagrid. which does not work

So the work around is to click the row then lift my index finger, then click hold and drag the row.  Which to me is goofy


Does this better illustrate my the issue?
9  General Category / General Discussion / Drag and Drop Datagrid - Source and target grid id's or something on: October 04, 2014, 04:31:47 PM
I have 4 simple tables, and when I drag and drop to one another everything works just fine.  I would like to be able to have table A drag drop to table C, but not be able to drop in table B and D.  and B and D drag drop but not from or to  A or C.  The source is just the row data, so that isn't helping me. anyone implemented something similar want to share the secret.

What I envisioned was to have A start drag and drop and then when drag enter on B return false or something to not allow the drop and then when it enters C it would drag enter and accept and allow the drop.

Also I don't know if it is a bug, but I have to add empty rows to a grid in order for it to accept a drop, figured it would just accept the row if it was in the right format. Seemed strange concept.
10  General Category / Bug Report / DND multiselect:true single click hold drag does not work on: October 04, 2014, 04:17:02 PM
I found a simple bug in DND when dealing with multiselect:true option.  When I decide to drag one item over, when I click and hold the row it will not drag and drop. instead I have to click the row to select it then click hold to drag it. 
11  General Category / Bug Report / Re: Easy UI 1.4 ScrollView Duplicate Data after using Load when data less than page on: September 07, 2014, 07:16:31 AM
Yes that seems to be what is going on.

not sure how to stop it from happening
12  General Category / Bug Report / Re: EasyUI 1.4 ScrollView DetailFormatter Index on: September 06, 2014, 04:56:29 PM
That worked also.  thanks for the help.
13  General Category / Bug Report / Re: Easy UI 1.4 ScrollView Duplicate Data after using Load when data less than page on: September 06, 2014, 04:46:58 PM
Well here is the Javascript.   A little background on the data.  It is Json coming from a Database that has approx 2300 rows.  Would have liked to just search and find the index of the row and go to it, but scrollview doesn't seem to want to do that.  so i decided to just filter.  And what I discovered was when I had less data come back from the filter call than the amount of the PageSize (50) it will call the cong.php url twice.  One request with just the filter field and the second with the filter field, the pageSize and rows.  And it fills the table with the same data twice.  and When I expandRow it makes the sub grid call to php to get whatever data it needs amd opens up just long enough to see it flicker color, but then reloads the full table again with the 2 calls, and that is where I am stuck.

As you can see below in the DoSearch function I use the Load Argument and  it works fine.  I would expect that line to only be called once no matter how many records are returned.

I attached an example of what it looks like.  The duplicate values is not good, but workable. The not workable piece is the fact that my detailViews wont work. 

So just a reminder, it I have enough rows to fill the space it does not duplicate, does not call anything twice and works as expected. 


var table='damcc';
         $(function(){
            var now = new Date();
            var minmax = [];
            $('#td').datebox({
               onSelect: function(date){
                  //$('#topbottom').datagrid('loadData', {"total":0,"rows":[]});
                  $('#topbottom').datagrid({
                     url:'./scripts/cong.php?date='+date.format("yyyy-mm-dd")
                  });
               }
            });
            
            /*$('#searchnodes').combobox({
               url:'./scripts/nodes.php',
               textField:'nodeid',
               valueField:'nodeid'
               });*/
            
            $('#td').datebox('setValue', now.format("mm/dd/yyyy"));
            
            $('#topbottom').datagrid({
               url:'./scripts/cong.php?date='+now.format("yyyy-mm-dd"),
               autoRowHeight:false,
               scrollbarSize:0,
               striped:true,
               title:"Congestion Viewer",
               toolbar:'#tb',
               singleSelect:false,
               fit:true,
               columns:[[
                  {field:'nodeid',title:'Nodeid',width:130, sortable:true},
                  {field:'1',title:'1',width:45, styler:styler100200, sortable:true},
                  {field:'2',title:'2',width:45, styler:styler100200, sortable:true},
                  {field:'3',title:'3',width:45, styler:styler100200, sortable:true},
                  {field:'4',title:'4',width:45, styler:styler100200, sortable:true},
                  {field:'5',title:'5',width:45, styler:styler100200, sortable:true},
                  {field:'6',title:'6',width:45, styler:styler100200, sortable:true},
                  {field:'7',title:'7',width:45, styler:styler100200, sortable:true},
                  {field:'8',title:'8',width:45, styler:styler100200, sortable:true},
                  {field:'9',title:'9',width:45, styler:styler100200, sortable:true},
                  {field:'10',title:'10',width:45, styler:styler100200, sortable:true},
                  {field:'11',title:'11',width:45, styler:styler100200, sortable:true},
                  {field:'12',title:'12',width:45, styler:styler100200, sortable:true},
                  {field:'13',title:'13',width:45, styler:styler100200, sortable:true},
                  {field:'14',title:'14',width:45, styler:styler100200, sortable:true},
                  {field:'15',title:'15',width:45, styler:styler100200, sortable:true},
                  {field:'16',title:'16',width:45, styler:styler100200, sortable:true},
                  {field:'17',title:'17',width:45, styler:styler100200, sortable:true},
                  {field:'18',title:'18',width:45, styler:styler100200, sortable:true},
                  {field:'19',title:'19',width:45, styler:styler100200, sortable:true},
                  {field:'20',title:'20',width:45, styler:styler100200, sortable:true},
                  {field:'21',title:'21',width:45, styler:styler100200, sortable:true},
                  {field:'22',title:'22',width:45, styler:styler100200, sortable:true},
                  {field:'23',title:'23',width:45, styler:styler100200, sortable:true},
                  {field:'24',title:'24',width:45, styler:styler100200, sortable:true},
                  {field:'25',title:'offpeak',width:50, styler:styler200400, sortable:true},
                  {field:'26',title:'onpeak',width:50, styler:styler200400, sortable:true}
               ]],
               onLoadSucces:function(){
                  
               },
               view: scrollview,
               rownumbers:true,
               pageSize:50,
               detailFormatter: function(index, data){
                  var index = data.nodeid;
                  index = index.replace(".","_");
                  index = index.replace(".","_");
                  index = index.replace(".","_");
                  index = index.replace(".","_");
                  return '<div style="padding:2px"><table id="tt-' + index + '"></table></div>';
               },
               onExpandRow: function(index,row){
                  var index = row.nodeid;
                  index = index.replace(".","_");
                  index = index.replace(".","_");
                  index = index.replace(".","_");
                  index = index.replace(".","_");
                  $('#tt-'+index).datagrid({
                     url:'./scripts/subcong.php?date='+$('#td').datebox('getValue')+'&nodeid='+row.nodeid+'&table='+table,
                     fitColumns:false,
                     singleSelect:true,
                     autoRowHeight:false,
                     height:'auto',
                     scrollsize:0,
                     columns:[[
                     {field:'nodeid',title:'Nodeid',width:127, sortable:true},
                     {field:'1',title:'1',width:45, styler:styler100200, sortable:true},
                     {field:'2',title:'2',width:45, styler:styler100200, sortable:true},
                     {field:'3',title:'3',width:45, styler:styler100200, sortable:true},
                     {field:'4',title:'4',width:45, styler:styler100200, sortable:true},
                     {field:'5',title:'5',width:45, styler:styler100200, sortable:true},
                     {field:'6',title:'6',width:45, styler:styler100200, sortable:true},
                     {field:'7',title:'7',width:45, styler:styler100200, sortable:true},
                     {field:'8',title:'8',width:45, styler:styler100200, sortable:true},
                     {field:'9',title:'9',width:45, styler:styler100200, sortable:true},
                     {field:'10',title:'10',width:45, styler:styler100200, sortable:true},
                     {field:'11',title:'11',width:45, styler:styler100200, sortable:true},
                     {field:'12',title:'12',width:45, styler:styler100200, sortable:true},
                     {field:'13',title:'13',width:45, styler:styler100200, sortable:true},
                     {field:'14',title:'14',width:45, styler:styler100200, sortable:true},
                     {field:'15',title:'15',width:45, styler:styler100200, sortable:true},
                     {field:'16',title:'16',width:45, styler:styler100200, sortable:true},
                     {field:'17',title:'17',width:45, styler:styler100200, sortable:true},
                     {field:'18',title:'18',width:45, styler:styler100200, sortable:true},
                     {field:'19',title:'19',width:45, styler:styler100200, sortable:true},
                     {field:'20',title:'20',width:45, styler:styler100200, sortable:true},
                     {field:'21',title:'21',width:45, styler:styler100200, sortable:true},
                     {field:'22',title:'22',width:45, styler:styler100200, sortable:true},
                     {field:'23',title:'23',width:45, styler:styler100200, sortable:true},
                     {field:'24',title:'24',width:45, styler:styler100200, sortable:true},
                     {field:'25',title:'offpeak',width:50, styler:styler200400, sortable:true},
                     {field:'26',title:'onpeak',width:46, styler:styler200400, sortable:true}
                  ]],
                  onResize:function(){
                     $('#topbottom').datagrid('fixDetailRowHeight',index);
                     
                  },
                  onLoadSuccess:function(){
                     setTimeout(function(){
                        $('#topbottom').datagrid('fixDetailRowHeight',index);
                     },0);
                  }
               });
               $('#topbottom').datagrid('fixDetailRowHeight',index);
               
            }
            });
            
         
            $("#rtmcc, #damcc, #delta").change(function(){
               if ($("#rtmcc").is(":checked")) {
                  table = 'rtmcc';
                  $('#topbottom').datagrid({
                     url:'./scripts/cong.php?date='+$('#td').datebox('getValue')+"&ret="+ret+"&table=rtmcc"
                  });
               }
               if ($("#damcc").is(":checked")) {
                  table = 'damcc';
                  $('#topbottom').datagrid({
                     url:'./scripts/cong.php?date='+$('#td').datebox('getValue')+"&ret="+ret+"&table=damcc"
                  });
               }
               if ($("#delta").is(":checked")) {
                  table = 'delta';
                  $('#topbottom').datagrid({
                     url:'./scripts/cong.php?date='+$('#td').datebox('getValue')+"&ret="+ret+"&table=delta"
                  });
               }
            });
         
         });
      
         
         
         function styler200400(value,row,index){
            if(value>=0){
               return 'background-color:'+GreenYellowRed(value, 600, 300)+';';
            }else{
               return 'background-color:'+Greentoblue(value, 600, 300)+';';
            }
         }
         
         function styler100200(value,row,index){
            if(value>=0){
               return 'background-color:'+GreenYellowRed(value, 100, 50)+';';
            }else{
               return 'background-color:'+Greentoblue(value, 100, 50)+';';
            }
         }
         function componentToHex(c) {
            var hex = c.toString(16);
            return hex.length == 1 ? "0" + hex : hex;
         }

         function rgbToHex(r, g, b) {
            return "#" + componentToHex(r) + componentToHex(g) + componentToHex(b);
         }
                  
         function GreenYellowRed(number, high, low) {
            var number; // working with 0-99 will be easier
            var r;
            var g;
            var b;
            number = number--;
           if (number < low) {
            // green to yellow
            if(number<0){
               r=0;
            }else{
               r = Math.floor(255 * (number / low));
            }
            g = 255;
            

           }else if (number>=low & number<high) {
            // yellow to red
            r = 255;
            g = Math.floor(255 * ((low-number%low) / low));
           }else{
            r=255;
            g=0;
           }
           b = 0;

           return rgbToHex(r, g, b);
         }
         
         function Greentoblue(number, high, low) {
            var number; // working with 0-99 will be easier
            var r;
            var g;
            var b;
            number = Math.abs(number);
           if (number < low) {
            // green to yellow
            if(number<0){
               b=0;
            }else{
               b = Math.floor(255 * (number / low));
            }
            g = 255;
            

           } else if(number>=low & number<high) {
            // yellow to red
            b = 255;
            g = Math.floor(255 * ((low-number%low) / low));
           }else{
            b=255;
            g=0;
           }
           r = 0;

           return rgbToHex(r, g, b);
         }
         
         function doSearch(){
            $('#topbottom').datagrid('load',{
               nodeid: $('#searchnodes').val()
            });
         }


14  General Category / Bug Report / Re: EasyUI 1.4 ScrollView DetailFormatter Index on: September 06, 2014, 07:49:32 AM
So I use detail formatter to place a div, and I use expand row to call and get my data to fill the row.  but what I discovered if I put an alert in the onExpandRow is that the row index would start back at 0 when scrollview was in play. and it caused me some headaches.  finally I added a unique ID in my data which was a good work around but here is the offending code

detailFormatter: function(index, data){
                  
                  return '<div style="padding:2px"><table id="tt-' + index + '"></table></div>';
               },
               onExpandRow: function(index,row){
                  $('#tt-'+index).datagrid({
                     url:'./scripts/subcong.php?date='+$('#td').datebox('getValue')+'&nodeid='+row.nodeid+'&table='+table,
                     fitColumns:false,
                     singleSelect:true,
                     autoRowHeight:false,
                     height:'auto',
                     scrollsize:0,
                     columns:[[
                     {field:'nodeid',title:'Nodeid',width:127, sortable:true},
                     {field:'1',title:'1',width:45, styler:styler100200, sortable:true},
                     {field:'2',title:'2',width:45, styler:styler100200, sortable:true},
                     {field:'3',title:'3',width:45, styler:styler100200, sortable:true},
                     {field:'4',title:'4',width:45, styler:styler100200, sortable:true},
                     {field:'5',title:'5',width:45, styler:styler100200, sortable:true},
                     {field:'6',title:'6',width:45, styler:styler100200, sortable:true},
                     {field:'7',title:'7',width:45, styler:styler100200, sortable:true},
                     {field:'8',title:'8',width:45, styler:styler100200, sortable:true},
                     {field:'9',title:'9',width:45, styler:styler100200, sortable:true},
                     {field:'10',title:'10',width:45, styler:styler100200, sortable:true},
                     {field:'11',title:'11',width:45, styler:styler100200, sortable:true},
                     {field:'12',title:'12',width:45, styler:styler100200, sortable:true},
                     {field:'13',title:'13',width:45, styler:styler100200, sortable:true},
                     {field:'14',title:'14',width:45, styler:styler100200, sortable:true},
                     {field:'15',title:'15',width:45, styler:styler100200, sortable:true},
                     {field:'16',title:'16',width:45, styler:styler100200, sortable:true},
                     {field:'17',title:'17',width:45, styler:styler100200, sortable:true},
                     {field:'18',title:'18',width:45, styler:styler100200, sortable:true},
                     {field:'19',title:'19',width:45, styler:styler100200, sortable:true},
                     {field:'20',title:'20',width:45, styler:styler100200, sortable:true},
                     {field:'21',title:'21',width:45, styler:styler100200, sortable:true},
                     {field:'22',title:'22',width:45, styler:styler100200, sortable:true},
                     {field:'23',title:'23',width:45, styler:styler100200, sortable:true},
                     {field:'24',title:'24',width:45, styler:styler100200, sortable:true},
                     {field:'25',title:'offpeak',width:50, styler:styler200400, sortable:true},
                     {field:'26',title:'onpeak',width:46, styler:styler200400, sortable:true}
                  ]],
15  General Category / Bug Report / Easy UI 1.4 ScrollView Duplicate Data after using Load when data less than page on: September 05, 2014, 10:10:33 PM
Scrollview duplicate data after calling Load method when number of rows is less than the pageSize value.

Also causes DetailView to go bonkers by calling the subgrid url then reloading then reloading the table twice.

Kind of a road block that I have not been able to find a workaround for yet.


Pages: [1] 2
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!