function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
AmanAman 

how can we save data through YUI data Table to salesforce objects

 

I have a VF page:-- 

 

 

<apex:page controller="testdatatable" >
<!-- Combo-handled YUI JS files: -->
<html>
<head>
<title> Yui Data Table with Visual Force Page </title>
</head>
<body>
<div id="basic"></div> 
</body>
<script>
function Init()
{
addTable();
return true;
}
YAHOO.util.Event.onDOMReady(Init);
</script>
<script >
function addTable()
{
var sectionsArr= new Array();
    <apex:repeat value="{!acc}" var="a">
     var sections=new Array();
   sections.push('{!a.id}');
    sections.push('{!a.name}'); 
    sections.push('{!a.website}');
     sectionsArr.push(sections);
  </apex:repeat>
          var myColumnDefs = [          {key:"id", sortable:true, resizeable:true},      {key:"Name", sortable:true, resizeable:true}
                                        {key:"Website", sortable:true, resizeable:true}
                             ];
                             
         var sectionsArr= new Array();
        var myDataSource= new YAHOO.util.DataSource(sectionsArr);
        myDataSource.responseType=YAHOO.util.DataSource.TYPE_JSARRAY;
        myDataSource.responseSchema={fields:["id","name", "website"]};
        var myDataTable= new Yahoo.widget.DataTable("basic", myColumnDefs, myDataSource, {caption:"My Salesforce Data"});
              }
</script>
</html>
</apex:page>

 

sebcossebcos

Hi,

in order to save data shown on a page you need to use apex:inputfield tags inside apex:form tags and use the save action of a commandbutton.

Alternatively, for YUI or any other javascript frameworks, you will need to marshal the data from the javascript layer to the apex layer.

This is not trivial. To see an example of this you can review this article: http://wiki.developerforce.com/index.php/Visualforce_blog which uses YUI and visualforce.