User Profile & Activity

leo Chandra Member
Page
of 14
Posted: April 21, 2015 3:36 AM

Hi Eric,

This issue happened because WebGrid language was set to "UseCulture" with no specific WebGrid culture set in LayoutSetting and the web application globalization culture was set to "auto". When the prefer language from browser was set to English UK (en-GB) this will cause WebGrid unable to display the text properly as WebGrid did not have a text definition for that culture. To force WebGrid to use English US language, you could set WebGrid culture in LayoutSettings to "en-US" like the following:

<LayoutSettings Culture="en-US">    <TextSettings Language="UseCulture">    </TextSettings>
</LayoutSettings>

In case you need to display WebGrid in different language, you could programatically change WebGrid culture using two-letter-ISO-language-name with the following code

WebGrid1.LayoutSettings.Culture =  System.Globalization.CultureInfo.CreateSpecificCulture(System.Globalization.CultureInfo.CurrentCulture.TwoLetterISOLanguageName);

note : above code will set WebGrid culture to "en-US" when the browser prefer language is "en-GB".

Best Regards,
Leo

Hi Bob,

This issue happen because the parent WebCombo value was null on load and focus on other row, thus current WebCombo show this alert message. For a work around, you could set parent WebCombo value when entering current WebCombo edit mode (WebGrid's OnEnterEditMode client side event) as the following:

function EnterEditMode(controlId, tableName, editObject){    var cell = editObject.ToCellObject();
    if (editObject.type == "WebComboNET")
    {
        var webCombo = editObject.element;
        if (webCombo.LinkSettings.Enabled && webCombo.LinkSettings.ParentWebCombo && webCombo.LinkSettings.ParentWebCombo.length > 0)
        {
            var parentWebCombo = webCombo.LinkSettings.ParentWebCombo[0];
            if (!parentWebCombo.Value)
            {
                var parentValue = cell.Row.GetCell(parentWebCombo.Index).Value;
                parentWebCombo.SetValue(parentValue);
            }
        }
    }
}

As a reference, I have include the modified WebForm1.aspx on attachment.

Best Regards,
Leo

Hi Jimmy,

After further investigation I have found that if you modify related entity in BeforeSaveChangesDelegate, The changes to related entity will also included in the return value. So the changes in server side that is done in this request will be reflected on client side.

Best Regards,
Leo

Hi Jimmy,

About the updated data for related entities, Did you want to achieve the following scenario?

Modified Main Entity in client side and save the changes -> Server Make calculation and Modified related Entity -> Server Return Main Entity and Related Entity that has been changed -> Client side update All changes.

If not, please elaborate the scenario that you would like to achieve.

Best Regards,
Leo

Hi Jimmy,

TrackRelatedEntityChanges was not mean for the behaviour where you want to include other related entities on server response. TrackRelatedEntityChanges was mean to indicate whether changes to related entities should be tracked in the editing process. Example: When you save Item model with changes only to it's RealtedEntity and TrackRelatedEntityChanges was set to false, save action won't be executed because the main model (Item) was not modified (ViewModel.IsDirty is false). But with TrackRelatedEntityChanges set to true, changes to RelatedEntity will make ViewModel.IsDirty set to true which mean that save action will be executed.

Best Regards,
Leo


Posted: April 15, 2015 10:31 AM

Hi Eric,

For your information, by default, We did not provide a language for English UK. So to use English UK language for webgrid, you should define your own language text by creating a new language file in localization manager. 

The problem that you have facing could be cause by the translation text for export menu have not been made. Please follow this step to set the needed localized text:

  1. Right click on WebGrid and click on WebGrid.Net Designer.
  2. Go to Localization Manager tab.
  3. Click Manage Language Files.
  4. Choose English (United Kingdom) in Language file pane.
  5. In TextSetting Items pane, expand ContextMenu and choose Export
  6. Please set the localized text for each items and Click Save Changes.

note: Please make sure that you have set the localization physical path correctly and The file for en-GB localization (wglang_en-GB.xml) was there.

Best Regards,
Leo

Posted: April 15, 2015 10:00 AM

Hi Cristobal,

It could be achieved by presenting the list in grouped list or sectioned list. For information regarding how to implement it, please refer to this Walktrough. As a reference, you could refer to Data Sample, could be found herewhich have implement this kind of feature.

Best Regards,
Leo

Hi Jimmy,

For your information, you could include the updated data from RelatedEntities. You could set the logic for the related entity changes in EntityContextProvider's BeforeSaveChangesDelegate and include related entity in changedEntityList. Currently we did not have a sample that demonstrate these behaviour yet, as a reference, the code below could be used to achieve it:

db.BeforeSaveChangesDelegate = (context, changedEntityList) =>{
    List<object> temp = new List<object>();
    RelatedEntity relatedEntity=null;
    var items = changedEntityList.OfType<Item>();
    var relatedEntities = changedEntityList.OfType<RelatedEntity>();
if (items.Count() > 0) { foreach (Item item in items) { if (relatedEntities.Count() > 0)
{ relatedEntity = relatedEntities.SingleOrDefault(o => o.ItemID == item.ItemID);
} if (relatedEntity == null)
{ relatedEntity = db.Context.RelatedEntities.SingleOrDefault(o => o.ItemID == item.ItemID);
temp.Add(relatedEntity); } // changes the related entity. relatedEntity.Count++;
} if (temp.Count > 0) { entityList = changedEntityList.Concat(temp).ToList();
} } };


Best Regards,
Leo

Hi Jimmy,

The default ViewModel ExecuteSave and the server side (ex: WebAPI) default save behaviour (db.SaveChanges(saveBundle)) that has been provided by crosslight has implement this kind of behaviour. By default, server side will include the updated value in it's return value and then client side (crosslight) will make an update accordingly based on it.

In your scenario, you may want to prevent the editor to be closed when save has been done succesfully. This could be achieve easily by setting CloseEditorOnSaveSucceed (in ViewModel) to false.

Best Regards,
Leo

Hi Mikaeel,

Exporting is not supported when binding mode is set to either WCF, WebService or Astoria. It is due to the datasource is handled externally from other external source, then return the data to Client-side directly to be processed. As for exporting, the data source needs to be on the Server-side in order to export the data and perform additional Server-side binding and processing.

And regarding copy table or row, it won't work due to chrome browser limitation itself. You won't be able to do ‘Copy Row’ action in non-IE browser. You might want to hide the “Copy Row” item if the browser not Internet Explorer by adding validation code in “OnRowContextMenu” client side event. Here’s the snippet example code how to hide the “Copy Row” item:

function WebGrid1_OnRowContextMenu(controlId, rowType, rowElement, menuObject){    var WebGrid1 = ISGetObject(controlId);
    if (!IS.ie)
    {
        //To hide "Copy Row" item
        menuObject.Items.GetNamedItem("mnuCopyRow").Hide();
        //To hide "Copy Table" item
        menuObject.Items.GetNamedItem("mnuCopyTable").Hide();
    }
    return true;
}

For your information, print functionality should work properly. Please tell me more information regarding the issue you have encounter with print feature. As a reference, I have attached a simple sample. Please have it evaluate by adding it to WebGrid sample included in installation folder.

Best Regards,
Leo

All times are GMT -5. The time now is 5:53 AM.
Previous Next