1

I have the following script:

/// <reference path="updateAjax.ts" />
/// <reference path="updateSetUp.ts" />
/// <reference path="../../Shared/typescript/reference.ts" />

module Admin.Grid {

    export function updateField(entity: string, $link: JQuery) {

        var link = new Link($link),
            idArr = $link.attr("id"),
            idTmp = idArr.split("_");

        link.AdminParams = Admin.Shared.getAdminParams(entity),
        link.Entity = entity;
        link.InputFieldType = $link.attr('id').split('_')[1];
        link.Row = idTmp[2],
        link.PartitionKey = $("tr[id='row_" + link.Row + "']").attr('data-pk'),
        link.RowKey = $("tr[id='row_" + link.Row + "']").attr('data-rk');
        link.InputFieldValue = $link.is(":checkbox") ? $link.is(":checked") : $link.val(),

        updateSetUp(link);
        updateAjax(link);
    }
}

And in another file:

/// <reference path="../../Shared/typescript/reference.ts" />

module Admin.Grid {

    export function updateSetUp(link: Link) {
        $("#modified_" + link.Row).html('Updating');
        $("#modifiedBy_" + link.Row).html('Updating');
        $("#input_" + link.InputFieldType + "_" + link.Row)
            .next('span').remove().end()
            .after('<span class="check-waiting"></span>');
    }

}

When the first script compiles to javascript I do not see any calls to updateSetup(link) or updateAjax(link)

I'm working in VS2012 with web essentials. I get no error messages or red underline. As far as I can see all my links are correct. Deleting the files and recreating makes no difference.

Here's the javascript that's produced:

var Admin;
(function (Admin) {
    (function (Grid) {
        function updateField(entity, $link) {
            var link = new Link($link);
            var idArr = $link.attr("id");
            var idTmp = idArr.split("_");

            link.AdminParams = Admin.Shared.getAdminParams(entity) , link.Entity = entity;
            link.InputFieldType = $link.attr('id').split('_')[1];
            link.Row = idTmp[2] , link.PartitionKey = $("tr[id='row_" + link.Row + "']").attr('data-pk') , link.RowKey = $("tr[id='row_" + link.Row + "']").attr('data-rk');
            link.InputFieldValue = $link.is(":checkbox") ? $link.is(":checked") : $link.val() , Grid.updateSetUp(link);
            Grid.updateAjax(link);
        }
        Grid.updateField = updateField;
    })(Admin.Grid || (Admin.Grid = {}));
    var Grid = Admin.Grid;

})(Admin || (Admin = {}));
4
  • I do see a call to Grid.updateAjax(link); Commented Nov 15, 2012 at 12:35
  • and Grid.updateSetUp(link); is just before it, albeit quite a bit to the right. Commented Nov 15, 2012 at 12:36
  • @Jan - Thank you very much. It seems maybe the problem is with formatting when it's converted to typescript. I guess it should maybe be on a new line. In fact when I look in VS2012 both are over to the very very far right off the screen and I missed them because of that. Commented Nov 15, 2012 at 12:38
  • I bet you should not use , instead of ; when writing typescript when you want to read the compile code ;-) Commented Nov 15, 2012 at 12:41

1 Answer 1

2

The calls are indeed there in the compiled code. Note the liberal use of commas instead of semicolons resulted in very long lines:

link.AdminParams = Admin.Shared.getAdminParams(entity) , link.Entity = entity;
link.InputFieldType = $link.attr('id').split('_')[1];
link.Row = idTmp[2] , link.PartitionKey = $("tr[id='row_" + link.Row + "']").attr('data-pk') , link.RowKey = $("tr[id='row_" + link.Row + "']").attr('data-rk');
link.InputFieldValue = $link.is(":checkbox") ? $link.is(":checked") : $link.val() , Grid.updateSetUp(link);
Grid.updateAjax(link); //<<<here and ...                                             ^here^
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks Jan. I just noticed the comma ", Grid.updateSetUp(link);" Removed that and all is okay. It's been driving me nuts for 30 minutes :-) I will accept your answer.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.