JEditable

JEditable

rswyattrswyatt Posts: 3Questions: 0Answers: 0
edited January 2013 in Plug-ins
Ok - so... I thought I had everything set up correctly, but, alas, there are some things not working.

I have a data table that is being populated by ajax... basically I'm writing the shell of the table and then using datatables with ajaxsource to take that table and populate it.

I'm also trying to do jeditable inline editing. Most of this works. I can get a field to update just fine.

My problem is with selects and populating them.

I call a function which takes some variable data and I create the aocols object through a loop... That's all, seemingly irrelevant.


[code]
var aocols = [];

for(i=0; i < classes.length; i++){
var addclass = '';

var tmp = false;
var fieldopts = false;
var lurl = '';
var ltype = '';
var sURL = '';
var cname = '';
var dt = '';

if(fieldoptions[i]){
tmp = fieldoptions[i].split(";");


if(tmp.length > 0){
fieldopts = true;

ltype = tmp[0];
lurl = tmp[1];
sURL = tmp[2];
cname = tmp[3];

}
}



var lt = 'GET';



if(classes[i]){
addclass = " "+classes[i];
} else {
addclass = '';
}

if(lurl == "YESNO"){
dt = "{'':'Please select...', '1':'Yes','0':'No'}";
ltype = "select";
}


if(ltype == ''){
ltype = 'text';
}

if(sorts[i] == 'false'){
if(fieldopts){

var obj = { sClass: defclass+addclass, bSortable: false, sUpdateURL: sURL, loadtype: 'GET', loadurl: lurl, type: ltype, columnName: cname, data: dt};
} else {
var obj = { sClass: defclass+addclass, bSortable: false };
}

} else {
if(fieldopts){
var obj = { sClass: defclass+addclass, sUpdateURL: sURL, loadtype: 'GET', loadurl: lurl, type: ltype, columnName: cname, data: dt };
} else {
var obj = { sClass: defclass+addclass };
}

}


aocols.push(obj);
}



//alert("index.php?option=com_crsmgr&controller=dashboard&type=json&task=" + ttitle + addVars);
var myDTable = jQuery('#'+tablename).dataTable( {
bJQueryUI: true,
"aaSorting": [],
"iDisplayLength": 15,
"aoColumns": aocols,
"sPaginationType": "full_numbers",
"bPaginate": true,
"bFilter": true,
"bInfo": true,
"bProcessing": true,
"bSort": true,
"bServerSide": true,
"sAjaxSource": "index.php?option=com_crsmgr&controller=dashboard&type=json&task=" + ttitle + addVars,
"fnInitComplete": function(){

},
"fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
// assuming ID is in column 0
jQuery(nRow).attr("id", aData[0]);
return nRow;
}
}).makeEditable({

sUpdateURL: "index.php?option=com_crsmgr&controller=fieldupdates&task=updateRecord&type="+utype
});
[/code]

The specific issue I'm having is that some of these fields are set to be type: 'select' , yet, no select is showing up when I click on the field. Just a regular text box shows up.

Also - I've tried putting aocols in the .makeEditable portion of the code - however - that yields me an $.editable.types[settings.type] is undefined.

So - I'm scratching my head wondering exactly what I'm doing wrong to not be able to populate the fields with selects vs text.

Any help would be appreciated!
This discussion has been closed.