EasyUI Forum
October 03, 2025, 06:42:42 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
  Home Help Search Login Register  
  Show Posts
Pages: [1]
1  General Category / EasyUI for jQuery / Datagrid dynamically change background-color or image of 1 specific cell on: May 24, 2013, 09:14:14 AM
Hi,

I need to dynamically change just 1 cells background-color within my datagrid, I have used the example below and this works.I removed the if(value) but then the entire column changed colour.

<script type="text/javascript"> 
        function cellStyler(value,row,index){ 
            if (value < 30){ 
                return 'background-color:#ffee00;color:red;'; 
            } 
        } 
    </script> 


what I am looking to do is replace my original methods:

document.getElementById('mycell1').innerHTML = "<image src='images/triangle_amber_big.png' />";

document.getElementById("mycell2").style.backgroundColor = "#f6ced8"; /*red*/

Any help appreciated,

 Thanks.
2  General Category / EasyUI for jQuery / Re: Datagrid getValue of specific cell on: May 19, 2013, 01:44:51 AM
Thank you stworthy, that works fine!
3  General Category / EasyUI for jQuery / Datagrid getValue of specific cell [solved] on: May 18, 2013, 08:51:58 AM
I've been trying to work out how to repeatedly get the value a specific datagrid cell for about 10 hours now,Please can someone help to correct my code? I haven't quite got to grips with this yet Cry , for example my column name is Part_Number and the the index is row 5 and I need to get the current value, I would have previously used document.getElementById

Code:
var v = $('#dg_spn').datagrid('getValue',{index: 5,row:{Part_Number:}});
alert(v);

Thanks
4  General Category / EasyUI for jQuery / Datagrid innerHTML rownumbers alignment problem on: May 16, 2013, 06:51:36 AM
Hi,
I save my datagrid to a blob and download as an rtf file to view in word, this works fine except the datagrid rownumbers are not aligned with the data rows

Code:
$('#tt').datagrid({
 title:'Report',
 width:750,
 height:460,
 remoteSort:false,
 singleSelect:true,
 rownumbers:true,
 nowrap:false,
 fitColumns:true,
 toolbar:toolbar,
 url:'./json/datagrid_Intfaults.json',
 
columns:[[
        
{field:'Active',title:'Active '},
                {field:'Historic',title:'Historic '},
                {field:'Status',title:'Status',styler:cellStyler}
   ]]





function saveTextAsFile()
{  
    var textToWrite =  $('#tt').datagrid('getPanel').html();
    
    var textFileAsBlob = new Blob([textToWrite], {type:'text/plain'});
    var fileNameToSaveAs = Qn;
    var downloadLink = document.createElement("a");
    downloadLink.href = window.webkitURL.createObjectURL(textFileAsBlob);
    downloadLink.download = fileNameToSaveAs;
    downloadLink.click();    
}

});

Example of saved file, as you see the row numbers do not align with the data any suggestions how to correct this?

UpdateSave

1
2
3
4
5
Active   Historic    Status
4166      Active   b7    
4166      Active     b6    
4166      Active    b5    
4166      Active    b4    
4166      Active     b3    
4166      Active       b2    


Thanks

Paul


5  General Category / EasyUI for jQuery / Re: Transform DataGrid from Table with dynamic data on: May 12, 2013, 12:52:01 PM
Kevin,

Thank you, that worked, I had tried updateRow from the documentation but must have had a syntax error and failed to get it to work, your example helped.

Paul
6  General Category / EasyUI for jQuery / Transform DataGrid from Table with dynamic data on: May 11, 2013, 02:29:05 AM
I have converted a html table to a datagrid, the original table had one column of cells updated dynamically @ ~500ms intervals using
Code:
 [size=10pt]<td id = "dynamicdata1">0</td>
Code:
document.getElementById('dynamicdata1').innerHTML =(tmp?'1':'0');
How would I  go about this in the datagrid?

Thanks

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