Advertisement
haizaar

Untitled

Oct 12th, 2011
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.        function getIOCfg() {
  2.             var cfg = {
  3.                 method: 'POST',
  4.                 data: "feed_id="+feedId,
  5.                 form: {
  6.                     id: "#myform",
  7.                     useDisabled: true,
  8.                     upload: false,
  9.                 },
  10.                 on: {
  11.                     failure: function(e) {
  12.                         alert("Boom from IO!");
  13.                     }
  14.                 }
  15.             };
  16.             return cfg;
  17.         }
  18.  
  19.         // rebuilds columns data
  20.         var columns = Array();
  21.         var dataSourceFields = Array();
  22.         Y.all(myconfig.s.activeFields).each(function (node) {
  23.             customFieldName = node.one(myconfig.s.customFieldName).get("value")
  24.             columns.push({ key : customFieldName });
  25.             dataSourceFields.push(customFieldName);
  26.         });
  27.  
  28.         // DataSource
  29.         var selectProductsDS = new Y.DataSource.IO({
  30.             source: myconfig.preiewURL
  31.         });
  32.         selectProductsDS.plug(Y.Plugin.DataSourceJSONSchema, {
  33.             schema: {
  34.                 resultFields: dataSourceFields,
  35.             }
  36.         });
  37.         selectProductsDS.after("response", function () {
  38.             selectProductsTable.render(target);
  39.             selectProductsDS.detachAll("response");
  40.         });
  41.  
  42.         // DataTable
  43.         var selectProductsTable = new Y.DataTable.Base({
  44.             columnset: columns,
  45.         });
  46.         selectProductsTable.plug(Y.Plugin.DataTableDataSource, {
  47.             datasource: selectProductsDS
  48.         });
  49.  
  50.         Y.one(target).setContent("");
  51.         selectProductsTable.datasource.load({
  52.             cfg : getIOCfg(EditFeedConfig.previewFormat),
  53.             /*
  54.             callback : {
  55.                 failure: function (o) {
  56.                     alert("Boom from DS!")
  57.                 }
  58.             }
  59.             */
  60.         });
  61.  
  62.  
  63.        
  64.  
  65.  
  66.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement