EasyUI Forum
March 29, 2024, 12:21:09 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 / EasyUI for jQuery / Expand Tree Grid for Multiple Levels down on: August 30, 2023, 12:06:15 PM
Hey all,
SO I have a tree grid. There are multiple rows deep. I need to click a link outside the grid where I pass in a value from the 3rd level down and need to get the grid to refresh and then expand level 1, and level 2 and then expand level 3 and select the row I passed in the id.
I know I can use this code: $(this).treegrid('expand', gridID).treegrid('select', gridIDSel);
if gridID is 1_1 then it will expand the first level and first row. Then inside level 2 gridIDSel: 2_6 then it will select that row.

If I want to highlight 3_22 then how can I expand 1_1 and 2_4 and then 3_20 (id's are examples)?
Do I need to use 3 different expand code lines where I know what the parent id is for the level 3 and then get the grand parent which is level 2 and great-grandparent for level 1, OR is there something where if i pass in a Level 3 id (3_22) to the expand code line, the all the above levels will expand?

Any thoughts on this? thanks...

2  General Category / EasyUI for jQuery / Re: Change background colour of a table cell in a treegrid with onClickCell on: July 19, 2023, 04:43:39 AM
Hey guys,
working with Larry on this and in our Grid we put in the code above, but the refreshRow code does not seem to work.


$('#ourGridName').treegrid({
         url:'com/Administration.cfc?method=getWhatWeNeed',
         method:'get',
         width:'97%',
         idField:'id',
         treeField:'col0',
         emptyMsg: "No Records Found",
         border: true,
         fit: true,
         singleSelect:true,
         checkOnSelect: true,
         fitColumns: true,
         striped: true,
         rownumbers: false,
         collapsible: true,
         lines: true,

         onClickCell: function(field,row,index){

            row['style'] = row['style']||{};
               console.log(row);
               console.log('row id: ' + row['id']);
               console.log('row style field: ' + row['style'][field]);
               alert(row['id']);
               alert(row['style'][field]);
               if (row['style'][field] == 'background:red;color:#fff'){
                        row['style'][field] = 'background:green;color:#fff';
               } else if (row['style'][field] == 'background:green;color:#fff'){
                  row['style'][field] = 'background:red;color:#fff';
               } else {
                  row['style'][field] = 'background:red;color:#fff';
               }
               alert(row['style'][field]);
         
               $(this).treegrid('refreshRow',row['id'])      

         },

         columns:[[  --- all our colum names and attributes below

The JSON that comes back from our external function is the same as what you have in the post, like:
var data =  [
   {  "id": 1, "name": "All Tasks", "begin": "3/4/2010", "end": "3/20/2010", "progress": 60, "iconCls": "icon-ok", "idField": 10 },
   { "idField": 11, "id": 2, "name": "Designing", "begin": "3/4/2010", "end": "3/10/2010", "progress": 100, "_parentId": 1, "state": "closed" },  and more..

MY QUESTION:
   in the refreshRow line above, when we use row['id'] which is in the idField attribute, what is that ID Field and how does it work with the refreshRow code? we have an id field in our json code that returns.
That is my guess as to why our code is not working but your example code works....ANY THOUGHTS that could help us more forward would be awesome.
thanks
Dan
3  General Category / EasyUI for jQuery / Re: check/uncheck a checkbox in a datagrid will check/un in another datagrid on: March 01, 2023, 07:08:33 AM
Hey,
This may have fixed my issue...It is great to have someone with tons of JEasyUI experience view the code and see what might be causing the issue...I am going to do some more testing and have my other developers do testing as well, but this might have fixed our issues...

Dan
4  General Category / EasyUI for jQuery / Re: check/uncheck a checkbox in a datagrid will check/un in another datagrid on: February 28, 2023, 06:01:14 AM
I replaced my older jEasyUI code with the newer download and my checkbox infinite loop issue was fixed and the main datagrid row select was also fixed so I can select just one grid row at a time.
SO 2 out of 3 issues were fixed.

The 3rd issue is in a regular grid now just trying to manually check a checkbox does not work, the checkbox just is not checkable manually...

here is the code for that grid:

$('#user_profiles_grid').datagrid({
         url:'com/User_Info.cfc?method=getUserProfileData',
         method:'get',
         queryParams: {
            user_id: <cfoutput>#session.userDataStruct.user_id#</cfoutput>,
            profile_search_terms: ''
         },

         emptyMsg: "No Records Found",
         loadMsg: 'Loading&hellp;',
         idField:'user_profile_id',
         toolbar: '#profileSearch',
         width: 980,
         height: 500,
         border: false,
         fit: true,
         singleSelect:true,
         checkOnSelect: false,
         selectOnCheck: false,
         scrollOnSelect: true,
         fitColumns: true,
         nowrap: true,
         autorowheight: true,
         striped: true,
         rownumbers: false,
         sortable: true,
         sortOrder: 'asc',
         remoteSort:false,
         halign: 'center',

         onBeforeCheck: function(index, row){
            $(this).datagrid('clearChecked');
            $(this).datagrid('selectRow', index);
         },
         onLoadSuccess:
            function (data) {
               for (var i = 0; i < data.rows.length; ++i) {
                  if (data.rows['user_profile_id'] == <cfoutput>#session.userDataStruct.current_profile_id#</cfoutput>){
                        $(this).datagrid('checkRow', i);
                  }
               }
            },
         onDblClickRow:
            function(index, row){
               var user_id = row['user_id'];
               var profile_id = row['user_profile_id'];
               //alert('user_id ' + user_id + ' profile_id ' + profile_id)
               changeProfile(user_id,profile_id,1);
            },
         columns:[[
            { field: 'user_profile_id', align: 'center', checkbox: true },
            {title: 'Name', field:'name',width: 200, align: 'center', sortable: true},
            {title: 'Email', field:'email', width: 150, align: 'center', sortable: true },
            {title: 'Region', field:'region',width: 200, align: 'center', sortable: true },
            {title: 'Role', field:'role',width: 250, align: 'center', sortable: true },
            {title: 'Last Login', field:'last_login',width: 100, align: 'center', sortable: true }
         ]]
      });


Hope you can fix this 3rd problem for me...I think that is all the issues we have with grids and checkboxes and selecting rows...

thanks again
dan
5  General Category / EasyUI for jQuery / Re: check/uncheck a checkbox in a datagrid will check/un in another datagrid on: February 26, 2023, 10:56:21 AM
Hey all,
Still looking to figure out how to adjust a basic grid to work with this new updated code. As stated in the previous posts, the new jeasy code fixes my checkbox issues but then in normal grid code does not allow single row selects but as you select row after row it just selects all of them without me having to hold down the crtl key.

How can we get together to figure out what to do to make this work for our checkbox issue in this post, but also keep the normal actions of grids in our code?

thanks
Dan
6  General Category / EasyUI for jQuery / Re: check/uncheck a checkbox in a datagrid will check/un in another datagrid on: February 21, 2023, 07:44:23 AM
Not sure how to help you with this and that is what is worrying me...but I will do my best.

All our normal display grids look basically like this (removing code lines and showing functions)

$('#PRCover').treegrid({
      url: './com/prCover.cfc?method=getGridPR',
      queryParams: {
            filter: '',
            sort: '',
            order: '',
            search_terms: '',
            id: '0_0',
            currentProfile_id: '<cfoutput>#session.current_profile.region_id#</cfoutput>',
            currentProfile_ISNational: '<cfoutput>#session.current_profile.isnational#</cfoutput>'
      },
      idField:'id',
      treeField:'col1',
      emptyMsg: "No Records Found",
      border: true,
      singleSelect:true,
      fit: true,
      fitColumns: true,
      striped: true,
      rownumbers: false,
      collapsible: true,
      lines: false,
      sortOrder: 'asc',
      remoteSort:false,
      showHeader: true,
      scrollbarSize : 18,

      toolbar: '#prcover_search',
      nowrap : true,

      remoteFilter:false,
      pagination:true,
      pageList: [10, 20, 30, 40, 50, 100, 250, 500, 1000],
      pageSize: 1000,
loadFilter: function(data,parent){
},
onSelect: function(node){

},
onContextMenu: function (e,row){
},
columns:[[
         {
            field   : 'action',
            title   : '',
            width   : 50,
            resizable: false,
            fixed: true,
            formatter: function (value, row, index) {
               var link = '';
               if (row['has_attach'] === true || row['has_attach'] === "true" ) {
                  link = '<a class="download-attachment-icon" title="Attachments" href="javascript:getAllAttachments(\'' + row['doc_set_id'] + '\')">&nbsp;</a>&nbsp;';
               }
               if (row['has_deliver'] === true || row['has_deliver'] === "true") {
                  link = link + '<a class="download-deliverable-icon" title="Deliverables" href="javascript:downloadDeliverable(\'' + row['id'] + '\')">&nbsp;</a>&nbsp;';
               }
               if (link.length) {
                  return link;
               }
            }
         },
         {title: 'ETO (ACO) / PR / LSD',field:'col1',width:'30%', sortable: true},
         {title: 'Region / Comment', field:'col2',width: '20%', sortable: true, align:'left'},
         {title: 'Funding Type', field:'col3', width:'10%', sortable: true},
         {title: 'Work Release', field:'col4', width:'10%', description: 'Work Release referenced to this PR Cover.', sortable: true},
         {title: 'Acceptance', field:'col5', width:'10%', sortable: true, align:'center'},
         {title: 'PR Amount  ', field:'col6', width:'16.5%', sortable: true, align:'right'}
      ]]
   })
   .treegrid('enableFilter')
   .treegrid('getPanel').find('tr.datagrid-filter-row').hide();

In this grid, when we just try to click on a row, and then another row, both rows stay selected....in the old code we have I select a row it is selected, and if I select a different row, the first row unselects and the new row is the only row selected.

Our other Grid that actually has checkboxes in it that were not checking:

$('#user_profiles_grid').datagrid({
         url:'com/User_Info.cfc?method=getUserProfileData',
         method:'get',
         queryParams: {
            user_id: <cfoutput>#session.userDataStruct.user_id#</cfoutput>,
            profile_search_terms: ''
         },

         emptyMsg: "No Records Found",
         loadMsg: 'Loading&hellp;',
         idField:'user_profile_id',
         toolbar: '#profileSearch',
         width: 980,
         height: 500,
         border: false,
         fit: true,
         singleSelect:true,
         checkOnSelect: false,
         selectOnCheck: false,
         scrollOnSelect: true,
         fitColumns: true,
         nowrap: true,
         autorowheight: true,
         striped: true,
         rownumbers: false,
         sortable: true,
         sortOrder: 'asc',
         remoteSort:false,
         halign: 'center',
onBeforeCheck: function(index, row){
            $(this).datagrid('clearChecked');
            $(this).datagrid('selectRow', index);
         },
onLoadSuccess:      function (data) {
},
onDblClickRow:
},
columns:[[
            { field: 'user_profile_id', align: 'center', checkbox: true },
            {title: 'Name', field:'name',width: 200, align: 'center', sortable: true},
            {title: 'Email', field:'email', width: 150, align: 'center', sortable: true },
            {title: 'Region', field:'region',width: 200, align: 'center', sortable: true },
            {title: 'Role', field:'role',width: 250, align: 'center', sortable: true },
            {title: 'Last Login', field:'last_login',width: 100, align: 'center', sortable: true }
         ]]
      });
As you see, nothing is really odd in the code for either one of these 2 grid types.

I am not sure how to give you more examples without emailing you the JS code we are using and also sending you screenshots of what is happening, OR doing a screenshare of what the issue is....

So, does this above help show you what our code looks like that is breaking when we add in the code you gave us to Fix the other issue in this forum post?

thanks for being patient....
Dan
7  General Category / EasyUI for jQuery / Re: check/uncheck a checkbox in a datagrid will check/un in another datagrid on: February 15, 2023, 06:02:49 AM
Hey,
when I Put in the update of the jeasyui code you gave me in this post, the Checkboxes worked just great in that grid.
However, in the rest of our application, all other grids stopped working correctly.

as I stated, all other grids you could not just select one row at a time, but it selected all rows...so I clicked on row one and it selected, then click on row 2, and row one and 2 selected and so forth.

Also another grid we displayed we had empty checkboxes in a grid, and those checkboxes stopped worked all together...

the the fix you gave me solved the one problem, but broke the rest of our system....so we had to back out.
If I could send you screen shots of what happened I could, but I could not attach any here...

thoughts?
8  General Category / EasyUI for jQuery / Re: check/uncheck a checkbox in a datagrid will check/un in another datagrid on: February 14, 2023, 05:33:53 AM
So far the code looks good, however we might have an issue and we are still working through it....we have lots of grids in our system, and now it look like we might have an issue where when we select a row (no checkboxes), and then select another row, the first row is left selected...so if I try to select the first 3 rows, all 3 are selected...
Could that be an issue with this fix, or do we need to add some attribute to all our girds to not allow multiple selections?

1st issue -- above can't just select 1 row, but it hightlights all rows without deselected the previous row.
2nd issue -- we have a grid with empty checkboxes on it where we are selecting user profiles and now those checkboxes are not working at all...we can't check them and make them selected.

so it seems like the fix you gave us for our checkboxes in grids for this forum discussion might have messed up other grid operations for us...

Do we need to backout the updated version you gave us?

I am going to get yelled at in my team meeting in about an hour, so the sooner i can have an answer the better...

thanks
Dan

PS -- wish I could attach screen shots to show you what is happening, but can't...
9  General Category / EasyUI for jQuery / Re: custom sort for datagrid or treegrid on: February 13, 2023, 07:05:43 AM
So this is what I did to solve it...i guess it is similar to what you just posted...
Prefix my numbers with a lot of ZEROS and then just did the same a ? b line....

DO you see anything bad with this or will this work because it worked for me.

sorter:function(a,b){
               // in the query create a field with leading 0 to do the default order by
               //pad each number with 0 to get it up to 20 numbers to make all the samelength
               a1=  a.padStart(20, '0');
               b1=  b.padStart(20, '0');

               return (a1>b1?1:-1);
            }},
10  General Category / EasyUI for jQuery / Re: check/uncheck a checkbox in a datagrid will check/un in another datagrid on: February 10, 2023, 10:55:05 AM
Good Afternoon...
I finally was able to get back to adding in this code and the updated JEasyUI framework.
I downloaded the framework and put it into my code, and BOOM, it just worked. I did not have to do anything with my code. So, it looks like version stated above to download had a fix in it for the checkboxes.

I really appreciate your help on this and the update to the framework.

Dan
11  General Category / EasyUI for jQuery / Re: custom sort for datagrid or treegrid on: February 10, 2023, 10:21:56 AM
here are some numbers I am trying to get in number order (1,2,3,4,5,6,7,8,9,10,11...)
1-1/10001/101
1-10/100001/101
1-11/110001/101
1-12/120001/101
1-13/130001/101
1-14/140001/101
1-15/150001/101
1-16/160001/101
1-17/170001/101
1-18/180001/101
1-19/190001/101
1-2/20001/101
1-20/200001/101
and more....

what you are seeing is the default sort, but this needs to be ordered by 1,2....10,11,12....

thanks again...
12  General Category / EasyUI for jQuery / Re: custom sort for datagrid or treegrid on: February 10, 2023, 06:45:13 AM
I understand it is a custom sorter, but I am not sorting on Dates, I am sorting on numbers from 1-x and need them to sort correctly....Just not sure what I am seeing in your code...is this how to do a sort via numbers?
13  General Category / EasyUI for jQuery / custom sort for datagrid or treegrid on: February 09, 2023, 10:19:13 AM
Hey all, we have data that will start with 1 and could go to 1000, 5000, etc. How can we do a custom sort on that column in the grid so we done get 1, 10, 11, 12, 13,14,15,16,17,18,19,2, 20  but instead get 1,2,3,4,5....10,11,12....

thanks
Dan
14  General Category / EasyUI for jQuery / Re: check/uncheck a checkbox in a datagrid will check/un in another datagrid on: February 03, 2023, 12:31:47 PM
Thanks for this information. I am passing this onto my team and will see what we need to do to get this updated so I can look into getting my checkboxes working correctly.

I will keep you updated.
thanks again...
dan
15  General Category / EasyUI for jQuery / Re: check/uncheck a checkbox in a datagrid will check/un in another datagrid on: February 02, 2023, 11:27:43 AM
Hey,
so I am looking at our jquery.easyui.min.js and the comment at the top says EasyUI for JQuery 1.10.2
if this the latest easyUI code? if not which one is?
if this is the latest, then maybe my code example above still has something wrong in it?

thanks for your continued help.
Dan
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!