Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Michel Bieleveld on Dec 02, 2008 05:37
open dhtmlx forum
Json attributes with DhtmlxSuite_pro_2008Rel2_80512

Dear DHTMLX,

Are the json attributes also supported with the DhtmlxSuite_pro_2008Rel2_80512 as shown in http://dhtmlx.com/docs/products/kb/index.shtml?cat=search&page=1&q=5673&ssr=yes&s=json%20cell%20attribute . At the moment my titles are empty and I was wondering if this is expected behaviour.

Kind regards.

Answer posted by Support on Dec 02, 2008 09:18
The build 80512 has not such functionality by default, you can use attached extension in addition to existing js files, to enable support of json attributes. 
Attachments (1)
Answer posted by Michel Bieleveld on Dec 02, 2008 10:39
Thanks for the quick response. I was already using the above supplied document, I think it is the same as supplied in the above mentioned post.

However I don`t see the title attribute in any of the fields when using a json value as {:value:'a',:title:'b'} , the value attribute works fine.

I instantiate the grid as follows:
mygrid = new dhtmlXGridObject('gridbox'); 
mygrid.setImagePath("/codebase/imgs/")
mygrid.setHeader("some columns");
mygrid.setInitWidths("some widths")
mygrid.setColAlign("etc")
mygrid.setColTypes("etc");
mygrid.setColSorting("etc")
mygrid.init();
mygrid.enableHeaderMenu();
changeView();
mygrid.setSkin("clear");
mygrid.attachEvent("onXLS",function(){
var span=document.getElementById("recfound");
span.style.color="red";
span.innerHTML= 'loading ...';
})
mygrid.attachEvent("onXLE",function(){
var span=document.getElementById("recfound");
span.style.color="";
span.innerHTML= mygrid.getRowsNum();
})
mygrid.enableSmartRendering(true,50);
mygrid.load("/overviews.js","json");
Am i missing something in order for the tooltips to work ? At the moment I only see the value as the value of the tooltip.

Answer posted by Michel Bieleveld on Dec 02, 2008 15:40
The problem seems to be in the statement eval("data="+data.xmlDoc.responseText +";"); for some reason when evaluated the object data:["cheese",{:title:"something", :value:"cheese"}] is evaluated to ["cheese","cheese"] . No idea why :( Do you have a suggestion ?
Answer posted by Michel Bieleveld on Dec 03, 2008 01:33
After finding out that my debugger is not reliable, I used firebugs console.info, I found out that the problem was that the title attribute was not used for an img column.
Don`t know if it is fixed in a newer release but the following modification seems to work:

eXcell_img.prototype.setValue=function(val){var title = val; .......

to

eXcell_img.prototype.setValue=function(val){var title = val;if(this.cell._attrs.title)var title = this.cell._attrs.title; ......


Answer posted by Support on Dec 03, 2008 01:56
Yes, the img column uses value of cell column, which can be specified as 
     image^title
In case of dhtmlxgrid 2.0 the title attribute works for all column types including img,  the modification which you made resolves  problem for grid 1.6 and will not have any drawbacks

Answer posted by Michel Bieleveld on Dec 04, 2008 05:07
Great ! Do you know the place where I can do the same trick for the ro cell type ?

Answer posted by Support on Dec 04, 2008 05:30
It must work for "ro" column without any additional steps. ( if it somehow still not work  - please contact us directly at support@dhtmlx.com - we will provide latest version of dhtmlxgrid.js for your version, which contain some fixes )

In common case , you can modify code of "ro" excell to have its own logic by defining
eXcell_img.prototype.getTitle=function(){
    return "anything";
};