Skip to content

i write this code for angular json schema form #227

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
varshildoshi opened this issue Mar 9, 2018 · 18 comments
Open

i write this code for angular json schema form #227

varshildoshi opened this issue Mar 9, 2018 · 18 comments

Comments

@varshildoshi
Copy link

{
"type" : "button",
"title" : "save",
onClick : "exampleOnSubmitFn($event)"
}

but does not work properly

@Alex130
Copy link

Alex130 commented Mar 9, 2018

Hi,
can you provide more information about your form (schema, data, layout)?
As a guess, you probably want this for a submit button :
"type": "submit", "style": "btn-info", "title" : "save", "onClick" : exampleOnSubmitFn($event)

@varshildoshi
Copy link
Author

yes,but i want to call my own method through submit button,but its not working..

@varshildoshi
Copy link
Author

i take one json for generate layout using typescript & angular 4,so if i create my own button for reset,submit,next & save,so need my own function for event,but in my json function is not work proprly...so give me solution..

@varshildoshi
Copy link
Author

i got the solution...

@varshildoshi
Copy link
Author

but one more thing,
this is my birthdate json
"birthdate" : {
"type" : "date"
},
this is my layout json for birthdate
{
"key" : "birthdate",
"type" : "date",
"flex" : "3 3 100px"
},
but it gives me wrong data for date,ex: if i select 3/4/2003 it returns 2/4/2003,what can i do for that??

@varshildoshi
Copy link
Author

if i take type="string" & layout type="date" its not working..

@varshildoshi
Copy link
Author

& i use angular material design for that..

@Alex130
Copy link

Alex130 commented Mar 9, 2018

"but it gives me wrong data for date,ex: if i select 3/4/2003 it returns 2/4/2003,what can i do for that??"

What timezone are you using? it is related to #191 .
The bug is not fixed but I wrote an override for my own project. Feel free to use it.
datePickerOverride.zip
I might submit a pull request to do things cleanly when I have the time.

In app.modules.ts :

{ provide: MAT_DATE_LOCALE, useValue: 'fr-FR' },
    { provide: MAT_DATE_FORMATS, useValue: MOMENT_DATE_FORMATS},
    { provide: DateAdapter, useClass : MomentDateAdapter }

and

export class AppModule {
  constructor(wl: WidgetLibraryService) {
    wl.registerWidget('date', NewMaterialDatepickerComponent);
  }
}

Replace fr by your desired language
The code was for my usage only, with Moments.js, and not fully tested, but I hope it helps

@Alex130
Copy link

Alex130 commented Mar 9, 2018

Btw, using your own function on Submit is done in the template's json-schema-form tag :

<json-schema-form framework="material-design" [layout]="layout" loadExternalAssets="false" [schema]="userScheme" [(ngModel)]="currentUser" (onSubmit)="submit($event)"></json-schema-form>

Note the (onSubmit) binding. The event Object contains your validated and submitted form.

@varshildoshi
Copy link
Author

i am not sure,so plz send me full code with output for datapicker..
plz...

@varshildoshi
Copy link
Author

and you can share related link for datepicker...for better understanding

@Alex130
Copy link

Alex130 commented Mar 12, 2018

Hi,
Material Datepicker this is the documentation for Material Datepicker. Note the DateAdapter, which is not configurable in angular2-json-schema-form in its current state.
After modifying your app.modules as above, the code in my previous comment is all you need to use the overriden class automatically, and the event in your submit function should contain the correct date (with your locale and the correct date for your timezone).
You can keep your schema and layout as it is in this post .

@varshildoshi
Copy link
Author

Thanks..Alex130

@varshildoshi
Copy link
Author

one more thing..Alex130
I want to use tinymce in my project,so if u have any idea about it..plz tell me...in angular 4,angular material

@Alex130
Copy link

Alex130 commented Mar 13, 2018 via email

@varshildoshi
Copy link
Author

ok..sure..
but do you know how to define & use my own css in json using angular material

@Alex130
Copy link

Alex130 commented Mar 19, 2018

I did a pull request about this a while ago : #221
Some attributes are already bound and you can use them, I added some of the missing ones, check it out.

@varshildoshi
Copy link
Author

hi Alex130
i want to help from you..
i want to create Drag & Drop in angular 4 using typescript,but some problem occures..
when i drop any text view generate text view in dropzone..it is using angular material..
if you know about that plz tell me..i am use jquery for drag & drop with angular material..so plz help me..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants