Show Posts
|
Pages: [1]
|
3
|
General Category / EasyUI for jQuery / Re: .treegrid('getRowIndex', row['id']) not working. Always returns a -1
|
on: August 14, 2023, 12:47:13 PM
|
Thanks jarry. That worked, but only for the first level. When I try it with the subsequent levels, while the row in question is selected, the parent row is not expanded. Here's what I've tried: function refreshGrid(grid_id){ var grid = '#' + grid_id; var row = $(grid).treegrid('getSelected'); if(row){ var grid_level = $(grid).treegrid('getLevel', row['id]']) $(grid).treegrid('reload'); if (grid_level ==0){ $(grid).treegrid('scrollTo',row['id']); $(grid).treegrid('selectRow',row['id']); $(grid).treegrid('highlightRow',row['id']); } else if (grid_level == 1){ // get the parrent node and id var parentNode = $(grid).treegrid('getParent', row['id']); var parent_id = parentNode['id']; // scroll to the parent node, expand it and select the row. $(grid).treegrid('scrollTo',parentNode['id']); $(grid).treegrid('expand', parentNode['id']); $(grid).treegrid('select', row['id']); } } }
What happens is that the grid is reloaded, but the parent node is collapsed. When I expand it, the row in question is selected. I am not sure what the issue is in this case, so any help would be appreciated.
|
|
|
5
|
General Category / EasyUI for jQuery / .treegrid('getRowIndex', row['id']) not working. Always returns a -1
|
on: August 10, 2023, 12:00:51 PM
|
Hi I am trying to use the getRowIndex to get the correct index of a particular row in a tree grid. However no matter what row is selected, if it's the first one, the 2nd or the 20th, it always returns a -1. Here's the code I use this to refresh the treegrid. function refreshGrid(grid_id){ var row = $('#' + grid_id).treegrid('getSelected'); console.log(row); if(row){ var rowIndex = $('#' + grid_id).datagrid('getRowIndex', row['id']); console.log(rowIndex); return false; $('#' + grid_id).treegrid('refresh',row['id']); $('#' + grid_id).treegrid('scrollTo',rowIndex); $('#' + grid_id).treegrid('selectRow',rowIndex); $('#' + grid_id).treegrid('highlightRow',rowIndex); } }
And here is a sample of the JSON being returned from the server: [{"work_release_id":213,"poc_profile_id":201,"has_attach":"true","lvl":1,"can_add_pl":"true","col8":"NaN","col7":" $.00","col6":"","state":"closed","can_edit_header":"true","col5":"New Formulation In Process","appr_doc_id":0,"col4":"09/20/2023","col3":"08/10/2023","col2":" 700.00","col1":"ASO-0213-000 VI 2 ","wr_rev_id":235,"can_edit_title":"true","can_generate_afa":"false","can_read_formulation":"true","poc_name":"ABC DEF","can_cancel_formulation":"false","id":"1_213","can_return_to_contractor":"false","can_submit_to_cnt":"true","can_delete_formulation":"true","can_init_revision":"false","can_read_approved_cost_structure":"false","doc_set_id":4390,"can_display_graph":"true","Level":1,"can_cancel_revision":"false","can_unsubmit_to_cnt":"false","can_email_poc":"false","form_doc_id":4339,"is_complete":1,"can_approve_wp":"false","lk_status_id":100,"can_change_wr_notes":"true","wrname":"ASO-0213-000 VI 2 (ABC DEF)","can_paste_pl":"false","can_change_wrpoc":"false","can_send_file_to_contractor":"false","can_unsign_wp":"false"},{"work_release_id":212,"poc_profile_id":173,"has_attach":"true","lvl":1,"can_add_pl":"true","col8":"NaN","col7":" $.00","col6":"","state":"closed","can_edit_header":"true","col5":"New Formulation In Process","appr_doc_id":0,"col4":"08/14/2024","col3":"09/21/2023","col2":" 3000.00","col1":"AWA-0212-000 impact test (GHI JKL)","wr_rev_id":234,"can_edit_title":"true","can_generate_afa":"false","can_read_formulation":"true","poc_name":"GHI JKL","can_cancel_formulation":"false","id":"1_212","can_return_to_contractor":"false","can_submit_to_cnt":"true","can_delete_formulation":"true","can_init_revision":"false","can_read_approved_cost_structure":"false","doc_set_id":4363,"can_display_graph":"true","Level":1,"can_cancel_revision":"false","can_unsubmit_to_cnt":"false","can_email_poc":"false","form_doc_id":4268,"is_complete":1,"can_approve_wp":"false","lk_status_id":100,"can_change_wr_notes":"true","wrname":"AWA-0212-000 impact test (GHI JKL)","can_paste_pl":"false","can_change_wrpoc":"false","can_send_file_to_contractor":"false","can_unsign_wp":"false"}] [\code]
Any help would be appreciated.
|
|
|
9
|
General Category / EasyUI for jQuery / Change background colour of a table cell in a treegrid with onClickCell
|
on: June 29, 2023, 08:36:13 AM
|
Greetings, I'm relatively new to jEasyUI so I'm kind of stuck trying to figure out out to change the background colour to change on the onClickCell event or something similar. I've tried a couple of different approaches using onClickCell and the jQuery .css() or the removeClass() and addClass() methods, but nothing seems to work. For instance, this approach, while it correctly displays an alert, the background colour doesn't change. onClickCell: function(index, row){ alert(index); $(this).css("background-color", "red"); }, Any suggestions etc., would be very appreciated.
|
|
|
|