JQuery and the HTML client
-
Wednesday, November 07, 2012 2:18 PM
Hi all
Hoping someone can point me in the right direction ! I'm attempting to create a related entity item in another table based on the current selected item. I have the relationships as I would have in Lightswitch 2011 where similar logic works OK. The saga here is that I'm using an external readonly data source and adding additional fields by using another table in application data.
Anyway I have no idea if it's possible to have a JQuery method similar to the below Linq code. I was intending to put it in the post_render method so that as soon as the detail is selected, the code makes sure that the related table has a related value - if it doesn't then it creates one. Any advice is gratefully received
Dim query As IDataServiceQueryable(Of HighRisk)
query = From existID In Me.DataWorkspace.ApplicationData.HighRisks
Where (existID.ICUattendees2Item_IdentNumber = Me.ICUattendees2.SelectedItem.IdentNumber)
Select existIDIf IsNothing(query.SingleOrDefault) Then
Dim newHighRisk As HighRisk = Me.DataWorkspace.ApplicationData.HighRisks.AddNew()
newHighRisk.ICUattendees2Item_IdentNumber = Me.ICUattendees2.SelectedItem.IdentNumber
Me.DataWorkspace.ApplicationData.SaveChanges()End If
All Replies
-
Friday, November 09, 2012 9:39 PM
no one able to help ? I realise I'm a noob but I thought my type of skill set was the the target audience of Lightswitch
i can't justify my company spending money on a server and a VS 2012 installation if I have no idea when the html client is going to go gold and there is no guidance over how to replicate screen handling functions between the vb/silverlight and the javascript/html versions.
Thanks anyway to those who read this this and were unable to comment. No thanks to the MS developers who purportedly monitor this site and have chosen not to help out
-
Sunday, November 11, 2012 3:47 AM
You are describing how you want to accomplish something, but perhaps it will help if you back up a bit and describe exactly what you need?
-
Monday, November 12, 2012 10:04 AM
Hi Sorry about my snarly post. I realise in the scheme of things my troubles are small but on paper lightswitch checks all the boxes for use in the UK hospital I work for ... we have a few silverlight apps published that work but the html client would be perfect it we can replicate the functionality.
As for what we need ... We have a bed management system using a sql server database. development of this is run by HP and is too expensive to get them to rollout a mobile version. We have readonly access to this database only. Several in-house created views of currently admitted patients exist on another sql server with linked server access that I developement access to (and so read/write). These views need to be visible to clinicians on a tablet device with the ability to store additional data not available in the HP system.
In silverlight lightswitch I linked the views and created code that when a readonly record is selected then the above linq query checked for an 'additional data table record' in application data and created a row if there wasn't one. This then allowed for extra data to be entered against the HP system readonly data whilst keeping the unique identifiers.
I really need to know if this sort of database code works in the html client. Linq queries executed between the html screen navigation. Hope this makes sense
-
Monday, November 12, 2012 1:38 PM
The HTML Client should be thought as as only the "presentation layer". The real business logic should remain in the middle layer that is shared by the Silverlight client. This is the layer that you get to when you open a table and select "Write Code". There are a ton of events to wire-up code to. This is where you want to put your code. On the "_Inserting" method you can create code that will create the row you need in the other table rather than doing it when a person just selets it on the screen.
Also, if you need HTML right now, I would use the methods described here:
A Full CRUD LightSwitch JQuery Mobile Application
The Visual Studio LightSwitch Marketplace
http://LightSwitchHelpWebsite.com
- Edited by ADefwebserverMVP Monday, November 12, 2012 1:39 PM
- Edited by ADefwebserverMVP Monday, November 12, 2012 2:09 PM
- Edited by ADefwebserverMVP Monday, November 12, 2012 2:09 PM
- Marked As Answer by Beth MassiMicrosoft Employee, Owner Monday, November 12, 2012 10:06 PM
-
Monday, November 12, 2012 1:52 PM
Hi Michael
Thank you for your reply - that was just the sort of clean comment of the functionality I was after. I'll look into your blog with more detail.
Thanks again
-
Monday, November 12, 2012 10:12 PM
Also they released a new version of the HTML Client:http://bit.ly/LightSwitchHTMLClient
The Visual Studio LightSwitch Marketplace
http://LightSwitchHelpWebsite.com
- Edited by ADefwebserverMVP Monday, November 12, 2012 10:12 PM
- Marked As Answer by iain1975 Tuesday, November 13, 2012 8:13 AM

