locked
Count not updating when counting table rows (after adding one) RRS feed

  • Question

  • following this code from this link:

    https://social.msdn.microsoft.com/Forums/vstudio/en-US/479cbc96-6ec2-4d9f-b2f8-a2b43a09111e/html-client-dynamically-count-records-in-a-collection-on-browse-screen?forum=lightswitch

    I have got my screen to count how many rows are present when the screen first loads. In my scenario I have a add button located on the bottom navigation bar. this opens up a dialog window where the user can add the relevant information. However when the user hits save, and is navigated back to the browse screen, the count still displays the previous value. If i was to refresh the page it updates but this is not what i am after, when i navigate back i want the value to add by one, am i missing something in this code?

                screen.ExpanderLines.addChangeListener("state", function() {
                        screen.countExp = screen.ExpanderLines.data.length;
                });

    thanks for any help

    Friday, April 17, 2015 1:40 PM

Answers

  • Try this:

        screen.ExpanderLines.addChangeListener("count", function () {
            screen.countExp = screen.ExpanderLines.count;
        });
    
    Dave


    Dave Baker | AIDE for LightSwitch | Xpert360 blog | twitter : @xpert360 | Xpert360 website | Opinions are my own. For better forums, remember to mark posts as helpful/answer.

    • Proposed as answer by Xpert360 Saturday, April 18, 2015 12:00 PM
    • Marked as answer by Crezzer7 Monday, April 20, 2015 3:25 PM
    Saturday, April 18, 2015 11:56 AM

All replies

  • Try this:

        screen.ExpanderLines.addChangeListener("count", function () {
            screen.countExp = screen.ExpanderLines.count;
        });
    
    Dave


    Dave Baker | AIDE for LightSwitch | Xpert360 blog | twitter : @xpert360 | Xpert360 website | Opinions are my own. For better forums, remember to mark posts as helpful/answer.

    • Proposed as answer by Xpert360 Saturday, April 18, 2015 12:00 PM
    • Marked as answer by Crezzer7 Monday, April 20, 2015 3:25 PM
    Saturday, April 18, 2015 11:56 AM
  • works perfect thankyou :) something so simple aswell

    Cr7

    Monday, April 20, 2015 3:25 PM