Page 1 of 2

Related Items-having a serial number for each row

Posted: 27 Mar 2017
by WinstonFroidPinto
Hi,
I want to have an incrementing serial number field in related items grid,first item should have serial number as 1 by default and on adding of each row it should increment by 1.How can I accomplish this?


Thanks,
Winston.

Re: Related Items-having a serial number for each row

Posted: 27 Mar 2017
by Dmitry Kozlov
Hi,
You can populated the incremental field either in a workflow or via JavaScript. To get the number of items in the list, use JSOM or REST-api:
http://sharepoint.stackexchange.com/que ... -in-a-list

Re: Related Items-having a serial number for each row

Posted: 27 Mar 2017
by WinstonFroidPinto
Hi,
Thanks for the reply.
I have two fields in the related items grid.I am able to populate one of the field which will get the value from form field for each of the items entered in the grid(inline editing),which i am able to do it through the following code:
fd.populateFieldsInGrid($('.related-items'), {
 FieldInRelatedItem: valuefromformfield
});

But the second field needs to be updated incrementally like the first row will have the value as 1 and next item entered should have the value as 2 and so on.Yes i am able to retrieve the count each time an item is being added but i am in confusion how to populate it on item basis.

Thanks,
Winston.

Re: Related Items-having a serial number for each row

Posted: 27 Mar 2017
by WinstonFroidPinto
Hi,
Also I would like to know how to accomplish the following:
In related items grid I have a dropdown field,on change if value=something then only make the other field editable and mandatory or else dont make it mandatory and readonly,similarly for the second entry and so on.How can this be achieved on per item basis?

Thanks,
Winston.

Re: Related Items-having a serial number for each row

Posted: 28 Mar 2017
by Dmitry Kozlov
Hi!
WinstonFroidPinto wrote:
27 Mar 2017

But the second field needs to be updated incrementally like the first row will have the value as 1 and next item entered should have the value as 2 and so on.Yes i am able to retrieve the count each time an item is being added but i am in confusion how to populate it on item basis.
You can try to handle adding new rows event and increment the index in your handler with JSLink. Then pass the new object to populateFieldsInGrid method or modify the original one. Another option is using our support service: we can simplify subscribing on editing events via our JS-framework, say this way:

Code: Select all

fd.relatedItems(0).add(function() { // the code of your handler }) 
It will take about 3 hours ($300). You can purchase the support minutes in the store:
https://spform.com/buy/support-maintenance

Re: Related Items-having a serial number for each row

Posted: 28 Mar 2017
by Dmitry Kozlov
WinstonFroidPinto wrote:
27 Mar 2017
In related items grid I have a dropdown field,on change if value=something then only make the other field editable and mandatory or else dont make it mandatory and readonly,similarly for the second entry and so on.How can this be achieved on per item basis?
It also can be done by customizing the grid view or a field with JSLink, ex.:
https://www.spjeff.com/2014/05/17/quick ... rendering/

Re: Related Items-having a serial number for each row

Posted: 31 Mar 2017
by WinstonFroidPinto
Hi,
I have shared the view of related item in the form with quick edit.I want to achieve something like if Purchase Type is Replacement then only make fields SAP Asset No and WDV mantatory or else they will be readonly and non mandatory.It should repeat for the other items in the grid as well.How can this be achieved?I went through someof jslink examples but all are invoked on addition of an item in jsgrid and not on change of a dropdown within an item.


Thanks,
Winston.

Re: Related Items-having a serial number for each row

Posted: 31 Mar 2017
by Dmitry Kozlov
So, do you want to make columns in the related items control (in grid mode) mandatory based on a value of a form field? If so, bind JSLink to those fields in the related items and check form's field value from the code.

You can send the detailed description of your case with screenshots of the form to support@spform.com and our support team will provide you with estimation of the task.

Re: Related Items-having a serial number for each row

Posted: 31 Mar 2017
by WinstonFroidPinto
Hi,
I want to make a field readonly/mandatory based on the dropdown value which is present in the related items grid itself for that particular item in the grid.


I have attached a screenshot of related items with quick edit for your reference.
There is a choice dropdown field in the grid,based on the value of it i want to make the other field readonly/not readonly.This should happen for each row added in the grid.I could not find any change event for dropdowns within related items as well. Nee more info on this.


Thanks,
Winston.

Re: Related Items-having a serial number for each row

Posted: 03 Apr 2017
by Dmitry Kozlov
Our support team can implement this logic for you. It will take 6 support hours ($600). If it's OK, purchase the support service in our store:
https://spform.com/buy/support-maintenance