Datatable not loading its data on my view page load ?

Datatable not loading its data on my view page load ?

sunildonsunildon Posts: 40Questions: 7Answers: 0

Hi everyone

I been doing work on DATATABLES now i am facing a wierd issue and i dont know why i am facing .

The things i done so far : 1)kept controller & action method name in ROUTE.CONFIG file like :

public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

        routes.MapRoute(
            name: "Default",
            url: "{controller}/{action}/{id}",
            defaults: new { controller = "Lead", action = "leadlistings", id = UrlParameter.Optional }
        );
    }

After mention so i get just table Headers with processing on top of that . i am having only around 10 recprds .

2)Intrestingly when i give in URL like localhost:portno/Lead/LeadListings in browser URL DataTable getting loaded with data .

On my initial load the Url seems to be like this lhttp://localhost:portno/ .Here i get Table sctruicture with a processing message wityh no data ?

Tried debugging controller method which fetches data to datatable not hitting on load of page wierd ?

Any suggestions are gold dust

My code :

$('#myDataTable').dataTable({
"bProcessing": true,
"bServerSide": true,
"bJQueryUI": true,
"sAjaxSource": "AjaxHandler", //THis is not going to controller on page load but it does next time i give controller/actionname is browser .
"sPaginationType": "full_numbers",
"aoColumns": [
{ "sName": "Source"},
{ "sName": "Region" },
{ "sName": "AssignTo" },
{ "sName": "LeadStatus" }
]
});

regards

Answers

  • allanallan Posts: 63,491Questions: 1Answers: 10,470 Site admin

    Can you link to a page showing the issue so we can take a look and debug it please. We can't offer any help with your server-side code, but if there is an issue on the client-side, I'll be able to spot that.

    Allan

  • sunildonsunildon Posts: 40Questions: 7Answers: 0

    yeah sorry for trouble allan . i resolved it . In sAjaxsource i given just a Action method name . It works fine when my project have one controller on load but i have many . When changed to Lead/ajaxhandler its started working like charm .

    I have some issue posted it forum been working on that more than a week is there a way i can send my project solution you can look into for me . Thank you

    cheers

This discussion has been closed.