Category Archives: StackOverFlow

Stack Overflow is a question and answer site for professional and enthusiast programmers.

Create table fetching data from SharePoint list using jQuery and Ajax

I’m trying to populate a table fetching data from SharePoint and so far I have been partially successful. This is the relevant code I’m using:

JS:

function theCall(url, mainFilter) {
var lastIssue = '';
$.getJSON(url, function (data) {
    for (var i = 0; i < data.d.results.length; i++) {
        var specialist = data.d.results[i].AssignedSpecialistValue,
            dateReceived = data.d.results[i].DateReceived,
            dueDate = data.d.results[i].DueDate,
            crop = data.d.results[i].CropsList,
            summaryField = data.d.results[i].Summary,
            issue = data.d.results[i].IssueValue;

        if (issue != lastIssue) {
            lastIssue = issue;
            $('.reportTable tbody').append('<td colspan="5" style="font-weight:bold; background-color:#97C897;color:#FFFFFF;height:1px;" class="issueHeader">' + issue + '</td><td style="padding:0; height:1px; background-color:#97C897"><div  class="counterSpan pull-right"></div></td></tr>');

        }


    }
    $('.reportTable tbody').append('<tr><td>' + summaryField + '</td><td>' + dateReceived + '</td><td>' + dueDate + '</td><td style="text-align: center;">' + crop + '</td><td style="text-align: center;">' + specialist + '</td></tr>');

});
}

read more

How to implicitly use the base definition of a method

I’m currently developping for python 2, and I’m trying to use abstract base classes to simulate interfaces. I have an interface, a base implementation of that interface and many subclasses that extend the base implementation. It looks like this:

class Interface(object):
    __metaclass__ = ABCMeta

class IAudit(Interface):
    @abstractproperty
    def timestamp(self):
        raise NotImplementedError()

    @abstractproperty
    def audit_type(self):
        raise NotImplementedError()

class BaseAudit(IAudit):
    def __init__(self, audit_type):
        # init logic
        pass

    @property
    def timestamp(self):
        return self._timestamp

    @property
    def audit_type(self):
        return self._audit_type

class ConcreteAudit(BaseAudit):
    def __init__(self, audit_type):
        # init logic
        super(ConcreteAudit, self).__init__(audit_type)
        pass

read more

How to implicitly use the base definition of a method

I’m currently developping for python 2, and I’m trying to use abstract base classes to simulate interfaces. I have an interface, a base implementation of that interface and many subclasses that extend the base implementation. It looks like this:

class Interface(object):
    __metaclass__ = ABCMeta

class IAudit(Interface):
    @abstractproperty
    def timestamp(self):
        raise NotImplementedError()

    @abstractproperty
    def audit_type(self):
        raise NotImplementedError()

class BaseAudit(IAudit):
    def __init__(self, audit_type):
        # init logic
        pass

    @property
    def timestamp(self):
        return self._timestamp

    @property
    def audit_type(self):
        return self._audit_type

class ConcreteAudit(BaseAudit):
    def __init__(self, audit_type):
        # init logic
        super(ConcreteAudit, self).__init__(audit_type)
        pass

read more

How to implicitly use the base definition of a method

I’m currently developping for python 2, and I’m trying to use abstract base classes to simulate interfaces. I have an interface, a base implementation of that interface and many subclasses that extend the base implementation. It looks like this:

class Interface(object):
    __metaclass__ = ABCMeta

class IAudit(Interface):
    @abstractproperty
    def timestamp(self):
        raise NotImplementedError()

    @abstractproperty
    def audit_type(self):
        raise NotImplementedError()

class BaseAudit(IAudit):
    def __init__(self, audit_type):
        # init logic
        pass

    @property
    def timestamp(self):
        return self._timestamp

    @property
    def audit_type(self):
        return self._audit_type

class ConcreteAudit(BaseAudit):
    def __init__(self, audit_type):
        # init logic
        super(ConcreteAudit, self).__init__(audit_type)
        pass

read more