xTMNTxRaphaelx
xTMNTxRaphaelx

Reputation: 1407

Jaydata with requirejs

I am getting the following error while using require.js with Jaydata:

 $.data is not defined

Here,is my code..

$data.Entity.extend("schedule_common", {
    'ScheduleCommonId'  :  { key:true,type:'int',nullable:false,required:true  }

});

I have written at the top of my file

require(['jaydata','datajs','inmemoryprovider'], function($){
    return {...........
....................}
});

Kindly suggest me a way!!

Upvotes: 1

Views: 331

Answers (2)

Dargos
Dargos

Reputation: 229

I modified the jaydata source and made it work

I just commented the 'amd' and the 'module' lines

(function(mod) {
      //if (typeof exports == "object" && typeof module == "object") return mod(exports); // CommonJS
      //if (typeof define == "function" && define.amd) return define(["exports"], mod); // AMD
      mod(self.acorn || (self.acorn = {})); // Plain browser env
    })(function(exports) {
      "use strict";
      ...

after that in the config :

 require(["jaydata", ...
     function ($data) {
          window.$data = $data;

hope this helps

Upvotes: 1

Robesz
Robesz

Reputation: 1646

require.js isn't supported in JayData yet, but I've found some community requests here (AMD supporT) - JayData backlog

Upvotes: 0

Related Questions