Page Index Toggle Pages: 1 2 [3]  Send TopicPrint
Very Hot Topic (More than 25 Replies) New questions, about localization and value sorting (Read 35861 times)
Xylon
Junior Member
**
Offline


I Love MindFusion!

Posts: 96
Joined: Feb 17th, 2014
Re: New questions, about localization and value sorting
Reply #30 - Apr 16th, 2014 at 7:07pm
Print Post  
I found where the issue is...when I load the data from datatable to calendar, normally there are several values to assign into calendar
Code
Select All
c.firstname = 111
c.tag = 222
_calendar.Schedule.Contacts.Add(c)
_calendar.Contacts.Add(c)

app.HeaderText = 333
app.StartTime = 555
app.EndTime = 666
app.Tag = 222
app.loc = 777

app.Contacts.Add(c)
_calendar.Schedule.Items.Add(app)
 



here c.tag and app.tag will have same value to be assigned with. But....if I pass a value into c.id(Attention at this moment I am not creating a new appointment on the calendar but loading data from datatable into the calendar)
exp:
Code
Select All
c.Id =xxx 



The page could work and display the data properly. But if then I try to create a new appointment on this calendar, after I click "save" nothing new will show up on the calendar, the calendar only has the appointments from datatable.

Inversely, if I do not assign c.Id with any value, the calendar works well, and display new created appointment well.

But I don't understand why c.Id will affect that

Lyubo wrote on Apr 16th, 2014 at 7:36am:
Are there any errors in your browser's developer console? It's difficult to guess where the problem may be. Can you paste here the code you use to load the appointments from the database in the calendar?
Or, you can attach here (or send to support@mindfusion.eu) a sample project that reproduces the issue, so that our developer can investigate.

Regards,
Lyubo
  
Back to top
 
IP Logged
 
Xylon
Junior Member
**
Offline


I Love MindFusion!

Posts: 96
Joined: Feb 17th, 2014
Re: New questions, about localization and value sorting
Reply #31 - Apr 16th, 2014 at 8:14pm
Print Post  
Btw, pls have a look at the screen shot, say once I create a new appointment on the calendar, what I could type in are "app.headertext, app.location, app.starttime, app.endtime", but the new appointment has a corresponding contact collection on  left of the calendar. Now I need to pass the new appointment values into a new row of my datatable, how can I get the corresponding contact value?

As I posted in the attachment, I foreach the app.contacts, but the count is 0 that means there is no value in the app.contacts collection....

I asked similar question one or two weeks ago but until today I haven't solved that....sigh

Thank you

Lyubo wrote on Apr 16th, 2014 at 7:36am:
Are there any errors in your browser's developer console? It's difficult to guess where the problem may be. Can you paste here the code you use to load the appointments from the database in the calendar?
Or, you can attach here (or send to support@mindfusion.eu) a sample project that reproduces the issue, so that our developer can investigate.

Regards,
Lyubo

  

q12.JPG (Attachment deleted)
Back to top
 
IP Logged
 
Lyubo
God Member
*****
Offline


MindFusion team

Posts: 511
Joined: Jun 17th, 2010
Re: New questions, about localization and value sorting
Reply #32 - Apr 17th, 2014 at 6:33am
Print Post  
Hi,

The Id property is used internally by the control's resource matching system and should have a certain structure. If you set it to some arbitrary value the appointment will not be associated with the contact and thus it will not be displayed in the grouped resource view - you will see the appointment if you switch to a non-groped view - i.e. Month or Week. That's the reason for both of your problems above.

If you don't change the Id value and leave the auto-generated one, your items should be properly associated with the contact resources.

Regards,
Lyubo
  
Back to top
 
IP Logged
 
Xylon
Junior Member
**
Offline


I Love MindFusion!

Posts: 96
Joined: Feb 17th, 2014
Re: New questions, about localization and value sorting
Reply #33 - Apr 17th, 2014 at 1:56pm
Print Post  
Oh yes you right...I can't occupy the id, no matter c.id or app.id...

Appreciate

Lyubo wrote on Apr 17th, 2014 at 6:33am:
Hi,

The Id property is used internally by the control's resource matching system and should have a certain structure. If you set it to some arbitrary value the appointment will not be associated with the contact and thus it will not be displayed in the grouped resource view - you will see the appointment if you switch to a non-groped view - i.e. Month or Week. That's the reason for both of your problems above.

If you don't change the Id value and leave the auto-generated one, your items should be properly associated with the contact resources.

Regards,
Lyubo

  
Back to top
 
IP Logged
 
Xylon
Junior Member
**
Offline


I Love MindFusion!

Posts: 96
Joined: Feb 17th, 2014
Re: New questions, about localization and value sorting
Reply #34 - Apr 25th, 2014 at 2:29pm
Print Post  
Hi,

I deployed my application to internal server to test it, found that it doesn't not work properly on different browsers(even not work properly sometimes on IE 11), have you ever had this kind of issue?

And what if I would have double-clicking empty cell gives first screen(attached) that is not needed as it does not have the event type selection. Only second screen(attached) is needed.

Question 3, about calendar.LocalizationInfo.SubjectCaption.

If I set it ="EventName", it's good, then if I set it = "Event Name"(A blank between Event and Name), the name will be overlap, see attachment 3. How to solve that? I tried to adjust the this.getControls()['subject'].element.style.width, but seems this issue is not caused by the width but boz of the start point is fixed...
Pls see attachments.

Thank you very much! You really help a lot!
  

q13.JPG (Attachment deleted)
q14.JPG (Attachment deleted)
q15.JPG (Attachment deleted)
Back to top
 
IP Logged
 
Lyubo
God Member
*****
Offline


MindFusion team

Posts: 511
Joined: Jun 17th, 2010
Re: New questions, about localization and value sorting
Reply #35 - Apr 28th, 2014 at 7:12am
Print Post  
Hi,

What problems are you experiencing with the control? Are there any script or server errors or is it just some unexpected behavior? Besides IE11 what other browsers are you testing with?

For your second question, to prevent the smaller new form from showing, handle the client-side FormShow event and set the cancel parameter of the event arguments to true. From the same handler create the desired form control and show it. Here's a small sample:
Code (HTML)
Select All
<planner:Calendar ID="Calendar1" ... FormShowScript="onFormShow" />
 


Code (Javascript)
Select All
function onFormShow(sender, args) {
    var form = args.get_form();
    if (form.getId() == "NewForm") {
        // Prevent the small new form from showing
        args.set_cancel(true);

        // Initialize the item's subject text to
        // an empty string (it's undefined by default)
        form.item.subject = "";

        // Initialize a new edit form with the item parameters
        var f = new MindFusion.Scheduling.EditForm(sender, form.item, 'new');
        // Show the edit form
        f.showForm();
    }
} 



Regarding question 3, the text in the label wraps not because of the textbox witdh, but because the label itself has a set width. To fix that just overwrite it. That can be done using jQuery in your custom form drawContent override:
Code (Javascript)
Select All
//$mindfusion is the jQuery alias used by the control.
// find the label
var subjectLabel = $mindfusion(this.getControls()['subject'].element.parentNode).find('span.text-label');
// set the label's width
subjectLabel.width(72); 


Regards,
Lyubo
  
Back to top
 
IP Logged
 
Xylon
Junior Member
**
Offline


I Love MindFusion!

Posts: 96
Joined: Feb 17th, 2014
Re: New questions, about localization and value sorting
Reply #36 - Apr 28th, 2014 at 2:33pm
Print Post  
Morning Lyubo,

I solved question 1, it was caused by the ie setting...(compatibility view setting).

There is an error for your answer to question 3, pls have a look at the attachment. The error come from code line
"var subjectLabel = $mindfusion(this.getControls()['subject'].element.parentNode).find('span.text-label');"

Thank you!

Lyubo wrote on Apr 28th, 2014 at 7:12am:
Hi,

What problems are you experiencing with the control? Are there any script or server errors or is it just some unexpected behavior? Besides IE11 what other browsers are you testing with?

For your second question, to prevent the smaller new form from showing, handle the client-side FormShow event and set the cancel parameter of the event arguments to true. From the same handler create the desired form control and show it. Here's a small sample:
Code (HTML)
Select All
<planner:Calendar ID="Calendar1" ... FormShowScript="onFormShow" />
 


Code (Javascript)
Select All
function onFormShow(sender, args) {
    var form = args.get_form();
    if (form.getId() == "NewForm") {
        // Prevent the small new form from showing
        args.set_cancel(true);

        // Initialize the item's subject text to
        // an empty string (it's undefined by default)
        form.item.subject = "";

        // Initialize a new edit form with the item parameters
        var f = new MindFusion.Scheduling.EditForm(sender, form.item, 'new');
        // Show the edit form
        f.showForm();
    }
} 



Regarding question 3, the text in the label wraps not because of the textbox witdh, but because the label itself has a set width. To fix that just overwrite it. That can be done using jQuery in your custom form drawContent override:
Code (Javascript)
Select All
//$mindfusion is the jQuery alias used by the control.
// find the label
var subjectLabel = $mindfusion(this.getControls()['subject'].element.parentNode).find('span.text-label');
// set the label's width
subjectLabel.width(72); 


Regards,
Lyubo

  

q16.JPG (Attachment deleted)
Back to top
 
IP Logged
 
Lyubo
God Member
*****
Offline


MindFusion team

Posts: 511
Joined: Jun 17th, 2010
Re: New questions, about localization and value sorting
Reply #37 - Apr 29th, 2014 at 5:23am
Print Post  
Hi,
The error means, that when the snippet is executed 'this' context is not the popup form but something else. Are you calling this code from inside your custom drawControls override? It's supposed to be there.
  
Back to top
 
IP Logged
 
Xylon
Junior Member
**
Offline


I Love MindFusion!

Posts: 96
Joined: Feb 17th, 2014
Re: New questions, about localization and value sorting
Reply #38 - Apr 29th, 2014 at 1:33pm
Print Post  
Oh great, it works now.

Thank you so much

Lyubo wrote on Apr 29th, 2014 at 5:23am:
Hi,
The error means, that when the snippet is executed 'this' context is not the popup form but something else. Are you calling this code from inside your custom drawControls override? It's supposed to be there.

  
Back to top
 
IP Logged
 
Xylon
Junior Member
**
Offline


I Love MindFusion!

Posts: 96
Joined: Feb 17th, 2014
Re: New questions, about localization and value sorting
Reply #39 - Apr 29th, 2014 at 7:45pm
Print Post  
Hi I found another issue about item modification on the calendar.

Say if I create a new item(schedule), based on calendar member
Code
Select All
ItemCreatingScript="itemCreating" 


JavaScript function "itemCreating" will be invoked to assign the item bar on calendar with corresponding color.
Code
Select All
switch (item.location)

		            case "X":
		                item.cssClass = 'X';

		                break; 



But I have also set
Code
Select All
ItemInplaceEditEndingScript ="itemEditing"
                               ItemModifiedScript ="itemEditing" 

as calendar members. What I want to do is once the location value has been changed  the JavaScript function "itemEditing" will be invoked to assign the item bar on calendar with new corresponding color...

But as I watched via breakpoint, item create action will invoke JavaScript function "itemCreating" but item edit action doesn't. Application jumps to "_calendar_ItemModified" method directly.

Lyubo wrote on Apr 29th, 2014 at 5:23am:
Hi,
The error means, that when the snippet is executed 'this' context is not the popup form but something else. Are you calling this code from inside your custom drawControls override? It's supposed to be there.
  
Back to top
 
IP Logged
 
Lyubo
God Member
*****
Offline


MindFusion team

Posts: 511
Joined: Jun 17th, 2010
Re: New questions, about localization and value sorting
Reply #40 - Apr 30th, 2014 at 9:23am
Print Post  
Hi,

The ItemCreated, ItemModified, ItemDeleted events are not raised on the client if AutoPostBack is enabled for the control. The validating events - ItemCreating, ItemModifying, etc. are still raised - that's why you're able to handle ItemCreating, but not ItemModified.

What you're trying to do can be achieved by either:

1. using the ItemModifying event instead of ItemModified, check if the location is changed, and apply the correct CSS class by using the calendar.editItem method:
Code (Javascript)
Select All
function itemModifying(sender, args) {
    if (args.get_changes().location) {
        var loc = sender.getResourceById(args.get_changes().location);
        if (loc.name == "Loc1")
            sender.editItem(args.get_item(), { cssClass: "Loc1" });
        else if (loc.name == "Loc2")
            sender.editItem(args.get_item(), { cssClass: "Loc2" });
        // etc...
    }
} 



or by

2. disabling AutoPostBack - in that case you'll need to postback the control yourself when needed - i.e. from the client-side ItemCreated, ItemModified, ItemDeleted, or in response to some user action. To postback the control you can use this code:
Code (Javascript)
Select All
function postbackCalendar() {
    var calendar = $find("<%= Calendar1.ClientID %>");
    if (calendar) {
        calendar.postback();
    }
}

//...

function itemCreated(sender, args) {
    // some processing...

    // postback the control
    postbackCalendar();
}

//... 



Regards,
Lyubo
  
Back to top
 
IP Logged
 
Xylon
Junior Member
**
Offline


I Love MindFusion!

Posts: 96
Joined: Feb 17th, 2014
Re: New questions, about localization and value sorting
Reply #41 - Apr 30th, 2014 at 2:29pm
Print Post  
Thank you so much Lyubo.

I didn't realize that ItemCreated, ItemModified, ItemDeleted events are disabled while autopostback is on.

Btw, the snippet works if I change the code to
Code
Select All
var loc = args.get_changes().location; 

, it will pass null value if the code is
Code
Select All
var loc = sender.getResourceById(args.get_changes().location) 



Lyubo wrote on Apr 30th, 2014 at 9:23am:
Hi,

The ItemCreated, ItemModified, ItemDeleted events are not raised on the client if AutoPostBack is enabled for the control. The validating events - ItemCreating, ItemModifying, etc. are still raised - that's why you're able to handle ItemCreating, but not ItemModified.

What you're trying to do can be achieved by either:

1. using the ItemModifying event instead of ItemModified, check if the location is changed, and apply the correct CSS class by using the calendar.editItem method:
Code (Javascript)
Select All
function itemModifying(sender, args) {
    if (args.get_changes().location) {
        var loc = sender.getResourceById(args.get_changes().location);
        if (loc.name == "Loc1")
            sender.editItem(args.get_item(), { cssClass: "Loc1" });
        else if (loc.name == "Loc2")
            sender.editItem(args.get_item(), { cssClass: "Loc2" });
        // etc...
    }
} 



or by

2. disabling AutoPostBack - in that case you'll need to postback the control yourself when needed - i.e. from the client-side ItemCreated, ItemModified, ItemDeleted, or in response to some user action. To postback the control you can use this code:
Code (Javascript)
Select All
function postbackCalendar() {
    var calendar = $find("<%= Calendar1.ClientID %>");
    if (calendar) {
        calendar.postback();
    }
}

//...

function itemCreated(sender, args) {
    // some processing...

    // postback the control
    postbackCalendar();
}

//... 



Regards,
Lyubo
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1 2 [3] 
Send TopicPrint