Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by shweta on Oct 07, 2008 09:30
open dhtmlx forum
how to take values of dhtmxgrid which is open in tab using dhmtlxtabbar

i have one jsp named search.jsp containing code for dhtmlktabbar like:


<table>
<tr>
<td>

<div hrefmode="ajax" id="a_tabbar" class="dhtmlxTabBar" imgpath="/js/dhtmlx/imgs/" style="width:900px; height:520px;" skinColors="#FCFBFC,#F4F3EE" >

<div id="create" width="100" name="Create" href="tab_create.jsp"></div>
<div id="maintain" width="100" name="Maintain" href="tab_maintain.jsp"></div>

</div>


</td>
</tr>
</table>



tab_create.jsp and tab_maintain.jsp containing dhtmxgrid .that grid have column checkbox.i need those checkbox selection values on search.jsp.can anyone suggest me how can do this thing.Please it's urgent.
Answer posted by Support on Oct 07, 2008 09:44
Because you are using AJAX mode, the content of sub-pages injected directly to the main page context, so you must be able to use grid object defined in tab_maintain.jsp and use its API to get value of checkboxes. Please beware that it will be available only after second tab loaded.


Answer posted by shweta on Oct 07, 2008 09:54
so can i do it as mygridmaintain.ceelById(1,1).getValue();

or is there any other method to get selected checkbox value in grid?
please reply urgent
Answer posted by Support on Oct 08, 2008 03:39
If you need to get IDs of all checked rows, you can use 
mygridmaintain.getCheckedRows(1); //return a comma separated list of IDs


Answer posted by shweta on Oct 08, 2008 03:53

thanx!!! but i'm having problem to get grid object on search.jsp

i cannot able to perform any operation on grid which was created on tab_maintain.jsp.

i want to perform any operation on that grid in parents jsp i.e. search.jsp

 

Please help me out.

 

 

here is code for tab_maintain.jsp

<div id="maintainPane" style="height:320px;padding:0; width:966px;"> </div>

var maintainGrid = null;
doInitGridForMaintain();
//Loading Grid for Maintain Tasks
function doInitGridForMaintain(){
 if( maintainGrid==null){
   maintainGrid = new dhtmlXGridObject('maintainPane');
 }
 
 maintainGrid.setImagePath("codebase/imgs/");

 maintainGrid.setHeader("#master_checkbox,&nbsp;,img:[codebase/imgs/flag.gif],Sr.#,PO #,Source,Part #,Amount,Supplier <br> Name,Action <br>Days IN,OUT,CANCEL,Facility,Buyer<br>Name,First<br>Delivery, $value to<br>Cancel,UnitPrice");
 //maintainGrid.attachHeader("#master_checkbox");
 maintainGrid.enableAutoHeight(false);
 maintainGrid.enableAutoWidth(false);

 maintainGrid.setInitWidths("23,23,40,50,100,50,80,85,85,50,40,40,85,90,60,90,80");
 maintainGrid.setColTypes("ch,sub_row,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro");
 maintainGrid.setColAlign("left,left,left,left");
 maintainGrid.setColSorting(",,str,int,str,str,int,str,str,str,str,str,str,str,str,int,int");

 maintainGrid.setSkin("MWB2");
 maintainGrid.init();

maintainGrid.addrow(1,"0,i'm here sub_row ,&nbsp;,002,<a href='samplenew.htm'>MWB2_111505051</a>,0588417Z01,200,200,Mogem,Sch,Lee Jones,8/6/2006");

}

Answer posted by Support on Oct 08, 2008 04:15
Which version of dhtmlxTabbar you are using?
There was an issue with access to locally defined vars in case of loading script bloks through AJAX
You can add next line to your code 

 maintainGrid = new dhtmlXGridObject('maintainPane');
 window.maintainGrid = maintainGrid; //need to be added

it will made var globally available for sure.  ( Or you can contact us directly at support@dhtmlx.com, we will send you latest codebase, where problem with vars visibility will be solved automatically )



Answer posted by shweta on Oct 08, 2008 04:56

thanks for that!!!!!!

now i'm having problem in attachevent for maintainGrid...i'm using

maintainGrid.attachEvent("onCheck",doOnCheck());

on tab_maintain.jsp after addingrow.this event call on when grid is loaded.but i want to call this event only when i select any check box in that grid.

Please help me out!

Answer posted by Support on Oct 08, 2008 06:50
Correct syntax is 
        maintainGrid.attachEvent("onCheck",doOnCheck);